MCPcopy Index your code
hub / github.com/python/cpython / InterningTestCase

Class InterningTestCase

Lib/test/test_marshal.py:620–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618 self._test(3)
619
620class InterningTestCase(unittest.TestCase, HelperMixin):
621 strobj = "this is an interned string"
622 strobj = sys.intern(strobj)
623
624 def testIntern(self):
625 s = marshal.loads(marshal.dumps(self.strobj))
626 self.assertEqual(s, self.strobj)
627 self.assertEqual(id(s), id(self.strobj))
628 s2 = sys.intern(s)
629 self.assertEqual(id(s2), id(s))
630
631 def testNoIntern(self):
632 s = marshal.loads(marshal.dumps(self.strobj, 2))
633 self.assertEqual(s, self.strobj)
634 self.assertNotEqual(id(s), id(self.strobj))
635 s2 = sys.intern(s)
636 self.assertNotEqual(id(s2), id(s))
637
638class SliceTestCase(unittest.TestCase, HelperMixin):
639 def test_slice(self):

Callers

nothing calls this directly

Calls 1

internMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…