diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-26 23:39:06 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-26 23:39:06 -0500 |
commit | 8a6e1b5e15368c9dd66b6b407b7328c2bd0360ad (patch) | |
tree | 624e46ced60e7f5cb55edcab5b3d93bddd804c28 /tests/test_tree.py | |
parent | 1330639ff7ae099ce80e77a8b6be6a0d75b60f04 (diff) |
The attribute list comes in as a dictionary, so stop turning it into a list for no reason. Saves code and a little time. Sort outgoing attributes so that the tests will run consistently.
Diffstat (limited to 'tests/test_tree.py')
-rw-r--r-- | tests/test_tree.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_tree.py b/tests/test_tree.py index f9163f1..ea10367 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -741,6 +741,14 @@ class TestElementObjects(SoupTest): self.assertTrue(soup.foo.has_key('attr')) self.assertFalse(soup.foo.has_key('attr2')) + def test_attributes_come_out_in_alphabetical_order(self): + markup = '<b a="1" z="5" m="3" f="2" y="4"></b>' + self.assertSoupEquals(markup, '<b a="1" f="2" m="3" y="4" z="5"></b>') + + def test_multiple_values_for_the_same_attribute_are_collapsed(self): + markup = '<b b="20" a="1" b="10" a="2" a="3" a="4"></b>' + self.assertSoupEquals(markup, '<b a="1" b="20"></b>') + def test_string(self): # A tag that contains only a text node makes that node # available as .string. |