summaryrefslogtreecommitdiff
path: root/bs4/tests/test_soup.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-23 11:16:45 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-23 11:16:45 -0500
commit2f72913160bedb509a8042693328d139e7c6b945 (patch)
treeeddcc9af34a533cdb06a1158b408f1856cb3982d /bs4/tests/test_soup.py
parent0339d1f4a0f7306cb8c1ef4d7cd609b06e33eb27 (diff)
Namespaced attributes are equal if they correspond to the same string.
Diffstat (limited to 'bs4/tests/test_soup.py')
-rw-r--r--bs4/tests/test_soup.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/bs4/tests/test_soup.py b/bs4/tests/test_soup.py
index 2b7c003..e9aaa78 100644
--- a/bs4/tests/test_soup.py
+++ b/bs4/tests/test_soup.py
@@ -3,7 +3,10 @@
import unittest
from bs4 import BeautifulSoup
-from bs4.element import SoupStrainer
+from bs4.element import (
+ SoupStrainer,
+ NamespacedAttribute,
+ )
from bs4.dammit import EntitySubstitution, UnicodeDammit
from bs4.testing import SoupTest
import warnings
@@ -233,3 +236,17 @@ class TestUnicodeDammit(unittest.TestCase):
msg = w[0].message
self.assertTrue(isinstance(msg, UnicodeWarning))
self.assertTrue("Some characters could not be decoded" in str(msg))
+
+
+class TestNamedspacedAttribute(SoupTest):
+
+ def test_attribute_is_equivalent_to_colon_separated_string(self):
+ a = NamespacedAttribute("a", "b")
+ self.assertEqual("a:b", a)
+
+ def test_attributes_are_equivalent_if_all_members_identical(self):
+ a = NamespacedAttribute("a", "b", "c")
+ b = NamespacedAttribute("a", "b", "c")
+ self.assertEqual(a, b)
+ b.namespace = "d"
+ self.assertNotEqual(a, b)