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

Method test_attributes

Lib/test/test_hmac.py:1232–1245  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1230class PythonCopyTestCase(CopyBaseTestCase, unittest.TestCase):
1231
1232 def test_attributes(self):
1233 # Testing if attributes are of same type.
1234 h1 = hmac.HMAC.__new__(hmac.HMAC)
1235 h1._init_old(b"key", b"msg", digestmod="sha256")
1236 self.assertIsNone(h1._hmac)
1237 self.assertIsNotNone(h1._inner)
1238 self.assertIsNotNone(h1._outer)
1239
1240 h2 = h1.copy()
1241 self.assertIsNone(h2._hmac)
1242 self.assertIsNotNone(h2._inner)
1243 self.assertIsNotNone(h2._outer)
1244 self.assertEqual(type(h1._inner), type(h2._inner))
1245 self.assertEqual(type(h1._outer), type(h2._outer))
1246
1247 def test_realcopy(self):
1248 # Testing if the copy method created a real copy.

Callers

nothing calls this directly

Calls 6

_init_oldMethod · 0.80
assertIsNoneMethod · 0.80
assertIsNotNoneMethod · 0.80
__new__Method · 0.45
copyMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected