diff options
| author | guido@google.com <guido@google.com> | 2011-03-29 19:09:45 (GMT) |
|---|---|---|
| committer | guido@google.com <guido@google.com> | 2011-03-29 19:09:45 (GMT) |
| commit | 69cfcabae3d72845d44e1078d25072fdbb02072c (patch) | |
| tree | 0aedaa424e8c8f7139567aed7b6980ea59e16c97 /Lib/test/test_collections.py | |
| parent | 2008a8f8c09b18fbd24e8039553d50a828dd3fb2 (diff) | |
| parent | e6c1eb92675f67d1907bd7ba00c44262c18e93d4 (diff) | |
| download | cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.zip cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.gz cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.bz2 | |
Merge.
Diffstat (limited to 'Lib/test/test_collections.py')
| -rw-r--r-- | Lib/test/test_collections.py | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 020f4e2..d4cc4a8 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -332,37 +332,12 @@ class TestNamedTuple(unittest.TestCase): # verify that _source can be run through exec() tmp = namedtuple('NTColor', 'red green blue') globals().pop('NTColor', None) # remove artifacts from other tests - self.assertNotIn('NTColor', globals()) exec(tmp._source, globals()) self.assertIn('NTColor', globals()) c = NTColor(10, 20, 30) self.assertEqual((c.red, c.green, c.blue), (10, 20, 30)) self.assertEqual(NTColor._fields, ('red', 'green', 'blue')) globals().pop('NTColor', None) # clean-up after this test - self.assertNotIn('NTColor', globals()) - - def test_source_importable(self): - tmp = namedtuple('Color', 'hue sat val') - - compiled = None - source = TESTFN + '.py' - with open(source, 'w') as f: - print(tmp._source, file=f) - - if TESTFN in sys.modules: - del sys.modules[TESTFN] - try: - mod = __import__(TESTFN) - compiled = mod.__file__ - Color = mod.Color - c = Color(10, 20, 30) - self.assertEqual((c.hue, c.sat, c.val), (10, 20, 30)) - self.assertEqual(Color._fields, ('hue', 'sat', 'val')) - finally: - forget(TESTFN) - if compiled: - unlink(compiled) - unlink(source) ################################################################################ |
