tests/test_datatypes.py | 7 ++++++- tests/test_elementpath.py | 11 +++++++++-- tests/test_schema_proxy.py | 13 +++++++------ tests/test_xpath2_parser.py | 1 - 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/tests/test_datatypes.py b/tests/test_datatypes.py index 2dcafdf..01a9046 100644 --- a/tests/test_datatypes.py +++ b/tests/test_datatypes.py @@ -628,7 +628,12 @@ class TimezoneTypeTest(unittest.TestCase): def test_hashing(self): if sys.version_info < (3, 8): - self.assertEqual(hash(Timezone.fromstring('+05:00')), 1289844826723787395) + if sys.maxsize > 2**32: + self.assertEqual( + hash(Timezone.fromstring('+05:00')), 1289844826723787395) + else: + self.assertEqual( + hash(Timezone.fromstring('+05:00')), 943661699) else: self.assertEqual(hash(Timezone.fromstring('+05:00')), 7009945331308913293) diff --git a/tests/test_elementpath.py b/tests/test_elementpath.py index 6368b75..482d2f1 100644 --- a/tests/test_elementpath.py +++ b/tests/test_elementpath.py @@ -22,6 +22,11 @@ # import unittest +try: + import xmlschema +except ImportError: + xmlschema = None + if __name__ == '__main__': try: from tests.test_helpers import ExceptionHelpersTest, NamespaceHelpersTest, NodeHelpersTest @@ -29,7 +34,8 @@ if __name__ == '__main__': from tests.test_context import XPathContextTest from tests.test_xpath1_parser import XPath1ParserTest, LxmlXPath1ParserTest from tests.test_xpath2_parser import XPath2ParserTest, LxmlXPath2ParserTest - from tests.test_schema_proxy import XPath2ParserXMLSchemaTest, LxmlXPath2ParserXMLSchemaTest + if xmlschema is not None: + from tests.test_schema_proxy import XPath2ParserXMLSchemaTest, LxmlXPath2ParserXMLSchemaTest from tests.test_selectors import XPathSelectorsTest from tests.test_package import PackageTest except ImportError: @@ -39,7 +45,8 @@ if __name__ == '__main__': from test_context import XPathContextTest from test_xpath1_parser import XPath1ParserTest, LxmlXPath1ParserTest from test_xpath2_parser import XPath2ParserTest, LxmlXPath2ParserTest - from test_schema_proxy import XPath2ParserXMLSchemaTest, LxmlXPath2ParserXMLSchemaTest + if xmlschema is not None: + from test_schema_proxy import XPath2ParserXMLSchemaTest, LxmlXPath2ParserXMLSchemaTest from test_selectors import XPathSelectorsTest from test_package import PackageTest diff --git a/tests/test_schema_proxy.py b/tests/test_schema_proxy.py index 14698c3..fd6db5b 100644 --- a/tests/test_schema_proxy.py +++ b/tests/test_schema_proxy.py @@ -43,12 +43,13 @@ except ImportError: @unittest.skipIf(xmlschema is None, "xmlschema library required.") class XPath2ParserXMLSchemaTest(test_xpath2_parser.XPath2ParserTest): - schema = xmlschema.XMLSchema(''' - - - - - ''') + if xmlschema is not None: + schema = xmlschema.XMLSchema(''' + + + + + ''') def setUp(self): self.schema_proxy = XMLSchemaProxy(self.schema) diff --git a/tests/test_xpath2_parser.py b/tests/test_xpath2_parser.py index 5ac4faa..90702af 100644 --- a/tests/test_xpath2_parser.py +++ b/tests/test_xpath2_parser.py @@ -353,7 +353,6 @@ class XPath2ParserTest(test_xpath1_parser.XPath1ParserTest): self.check_value(u"fn:compare('Strasse', 'Straße', 'it_IT')", -1) self.check_value(u"fn:compare('Strassen', 'Straße')", 1) self.check_value(u"fn:compare('Strasse', 'Straße', 'de_DE')", -1) - self.check_value(u"fn:compare('Strasse', 'Straße', 'deutsch')", -1) with self.assertRaises(locale.Error): self.check_value(u"fn:compare('Strasse', 'Straße', 'invalid_collation')")