make TestAccelerator[Not]Imported for ElementTree more robust

This commit is contained in:
Eli Bendersky 2012-02-16 19:55:29 +02:00
parent 66e6f8e525
commit 292f9a891d
2 changed files with 3 additions and 9 deletions

View File

@ -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):

View File

@ -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():