diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2012-07-29 14:38:45 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2012-07-29 14:38:45 (GMT) |
commit | 2b16844326f9a88f7c5daf16abfb04cee70f02bc (patch) | |
tree | 87c57029fd16e884bd7f1a31cb474dd0bc661925 /Lib/test/test_xml_etree_c.py | |
parent | 5ee9892406c4299826f553b6b73c046229c6040c (diff) | |
parent | 33f799725cb9ae21f0fed87eea4b13d7611ceeee (diff) | |
download | cpython-2b16844326f9a88f7c5daf16abfb04cee70f02bc.zip cpython-2b16844326f9a88f7c5daf16abfb04cee70f02bc.tar.gz cpython-2b16844326f9a88f7c5daf16abfb04cee70f02bc.tar.bz2 |
Issue #15467: Merge 3.2
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r-- | Lib/test/test_xml_etree_c.py | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index eaeeb56..e44c6ca 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -41,38 +41,30 @@ class TestAcceleratorImported(unittest.TestCase): @unittest.skipUnless(cET, 'requires _elementtree') +@support.cpython_only class SizeofTest(unittest.TestCase): def setUp(self): - import _testcapi - gc_headsize = _testcapi.SIZEOF_PYGC_HEAD - # object header - header = 'PP' - if hasattr(sys, "gettotalrefcount"): - # debug header - header = 'PP' + header - # fields - element = header + '5P' - self.elementsize = gc_headsize + struct.calcsize(element) + self.elementsize = support.calcobjsize('5P') # extra self.extra = struct.calcsize('PiiP4P') + check_sizeof = support.check_sizeof + def test_element(self): e = cET.Element('a') - self.assertEqual(sys.getsizeof(e), self.elementsize) + self.check_sizeof(e, self.elementsize) def test_element_with_attrib(self): e = cET.Element('a', href='about:') - self.assertEqual(sys.getsizeof(e), - self.elementsize + self.extra) + self.check_sizeof(e, self.elementsize + self.extra) def test_element_with_children(self): e = cET.Element('a') for i in range(5): cET.SubElement(e, 'span') # should have space for 8 children now - self.assertEqual(sys.getsizeof(e), - self.elementsize + self.extra + - struct.calcsize('8P')) + self.check_sizeof(e, self.elementsize + self.extra + + struct.calcsize('8P')) def test_main(): from test import test_xml_etree, test_xml_etree_c |