diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 11:56:40 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 11:56:40 -0500 |
commit | b7749c50a2c96ccf6982cfa1ca02d883e31e0af9 (patch) | |
tree | 404063e3bb580627a6cabad1b80774981d4f5232 /bs4/testing.py | |
parent | 2f72913160bedb509a8042693328d139e7c6b945 (diff) |
Bumped version number.
Diffstat (limited to 'bs4/testing.py')
-rw-r--r-- | bs4/testing.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/bs4/testing.py b/bs4/testing.py index b2ca180..1945c02 100644 --- a/bs4/testing.py +++ b/bs4/testing.py @@ -360,16 +360,28 @@ class HTMLTreeBuilderSmokeTest(object): class XMLTreeBuilderSmokeTest(object): + def test_docstring_generated(self): + soup = self.soup("<root/>") + self.assertEqual( + soup.encode(), b'<?xml version="1.0" encoding="utf-8">\n<root/>') + + def test_docstring_includes_correct_encoding(self): + soup = self.soup("<root/>") + self.assertEqual( + soup.encode("latin1"), + b'<?xml version="1.0" encoding="latin1">\n<root/>') + + + def test_tags_are_empty_element_if_and_only_if_they_are_empty(self): + self.assertSoupEquals("<p>", "<p/>") + self.assertSoupEquals("<p>foo</p>") + def test_namespaces_are_preserved(self): - markup = '<root xmlns:a="http://www.example.com/" xmlns:b="http://example.net/"><a:foo>This tag is in the a namespace</a:foo><b:foo>This tag is in the b namespace</b:foo></root>' + markup = '<root xmlns:a="http://example.com/" xmlns:b="http://example.net/"><a:foo>This tag is in the a namespace</a:foo><b:foo>This tag is in the b namespace</b:foo></root>' soup = self.soup(markup) root = soup.root - import pdb; pdb.set_trace() - self.assertEquals("http://www.example.com/", root['xmlns:a']) - self.assertEquals("http://www.example.net/", root['xmlns:b']) - - - pass + self.assertEquals("http://example.com/", root['xmlns:a']) + self.assertEquals("http://example.net/", root['xmlns:b']) |