MCPcopy Create free account
hub / github.com/python/cpython / test_bytes_subclass

Method test_bytes_subclass

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

Source from the content-addressed store, hash-verified

1417 self.assert_digest_not_equal(a, b)
1418
1419 def test_bytes_subclass(self):
1420 class B(bytes):
1421 def __eq__(self, other):
1422 raise ValueError("should not be called")
1423
1424 a, b = B(b"foobar"), B(b"foobar")
1425 self.assert_digest_equal(a, b)
1426 a, b = B(b"foobar"), b"foobar"
1427 self.assert_digest_equal(a, b)
1428 a, b = B(b"foobar"), B(b"foobaz")
1429 self.assert_digest_not_equal(a, b)
1430
1431
1432class HMACCompareDigestTestCase(CompareDigestMixin, unittest.TestCase):

Callers

nothing calls this directly

Calls 3

assert_digest_equalMethod · 0.95
BClass · 0.70

Tested by

no test coverage detected