From 292f9a891d214fd5098bedb9b4117fc9c36a0fe7 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Thu, 16 Feb 2012 19:55:29 +0200 Subject: make TestAccelerator[Not]Imported for ElementTree more robust --- Lib/test/test_xml_etree.py | 4 +--- Lib/test/test_xml_etree_c.py | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 0d1eb22..6060e06 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1907,9 +1907,7 @@ class CleanContext(object): class TestAcceleratorNotImported(unittest.TestCase): # Test that the C accelerator was not imported for pyET def test_correct_import_pyET(self): - # In the C accelerator, Element is just a factory function, not an - # actual class. In the Python version it's a class. - self.assertIsInstance(pyET.Element, type) + self.assertEqual(pyET.Element.__module__, 'xml.etree.ElementTree') def test_main(module=pyET): diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index d821b81..dbe1c3a 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -46,15 +46,11 @@ class MiscTests(unittest.TestCase): finally: data = None +@unittest.skipUnless(cET, 'requires _elementtree') class TestAcceleratorImported(unittest.TestCase): # Test that the C accelerator was imported, as expected def test_correct_import_cET(self): - # In the C accelerator, Element is just a factory function, not an - # actual class. In the Python version it's a class. - self.assertNotIsInstance(cET.Element, type) - - #def test_correct_import_cET_alias(self): - #self.assertNotIsInstance(cET_alias.Element, type) + self.assertEqual(cET.Element.__module__, '_elementtree') def test_main(): -- cgit v0.12