Issue #25548: Showing memory address of class objects in repl

This commit is contained in:
Kushal Das 2016-06-04 16:21:13 -07:00
parent 409482251b
commit 5801ecb440
20 changed files with 106 additions and 92 deletions

View file

@ -127,7 +127,10 @@ class CmdLineTest(unittest.TestCase):
print(printed_package)
print(printed_argv0)
print(printed_cwd)
self.assertIn(printed_loader.encode('utf-8'), data)
expected = printed_loader.encode('utf-8')
idx = expected.find(b"at 0x")
expected = expected[:idx]
self.assertIn(expected, data)
self.assertIn(printed_file.encode('utf-8'), data)
self.assertIn(printed_package.encode('utf-8'), data)
self.assertIn(printed_argv0.encode('utf-8'), data)
@ -158,6 +161,8 @@ class CmdLineTest(unittest.TestCase):
def test_dash_c_loader(self):
rc, out, err = assert_python_ok("-c", "print(__loader__)")
expected = repr(importlib.machinery.BuiltinImporter).encode("utf-8")
idx = expected.find(b"at 0x")
expected = expected[:idx]
self.assertIn(expected, out)
def test_stdin_loader(self):
@ -171,6 +176,8 @@ class CmdLineTest(unittest.TestCase):
finally:
out = kill_python(p)
expected = repr(importlib.machinery.BuiltinImporter).encode("utf-8")
idx = expected.find(b"at 0x")
expected = expected[:idx]
self.assertIn(expected, out)
@contextlib.contextmanager