"""Test defined selectors.""" from .. import util class TestDefined(util.TestCase): """Test defined selectors.""" def test_defined_html(self): """Test defined HTML.""" markup = """
""" self.assert_selector( markup, 'body :defined', ['0', '2', '3'], flags=util.HTML ) @util.skip_no_lxml def test_defined_xhtml(self): """Test defined XHTML.""" markup = """
""" from lxml import etree self.assert_selector( markup, 'body :defined', # We should get 3, but for LXML versions less than 4.4.0 we don't for reasons stated above. ['0', '2'] if etree.LXML_VERSION < (4, 4, 0, 0) else ['0', '1', '2'], flags=util.XHTML ) def test_defined_xml(self): """Test defined HTML.""" markup = """
""" # Defined is a browser thing. # XML doesn't care about defined and this will match nothing in XML. self.assert_selector( markup, 'body :defined', [], flags=util.XML )