MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_attributes

Method test_attributes

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

Source from the content-addressed store, hash-verified

1276class PythonCopyTestCase(CopyBaseTestCase, unittest.TestCase):
1277
1278 def test_attributes(self):
1279 # Testing if attributes are of same type.
1280 h1 = hmac.HMAC.__new__(hmac.HMAC)
1281 h1._init_old(b"key", b"msg", digestmod="sha256")
1282 self.assertIsNone(h1._hmac)
1283 self.assertIsNotNone(h1._inner)
1284 self.assertIsNotNone(h1._outer)
1285
1286 h2 = h1.copy()
1287 self.assertIsNone(h2._hmac)
1288 self.assertIsNotNone(h2._inner)
1289 self.assertIsNotNone(h2._outer)
1290 self.assertEqual(type(h1._inner), type(h2._inner))
1291 self.assertEqual(type(h1._outer), type(h2._outer))
1292
1293 def test_realcopy(self):
1294 # 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