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

Method test_string_subclass

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

Source from the content-addressed store, hash-verified

1405 self.assert_digest_not_equal(a, b)
1406
1407 def test_string_subclass(self):
1408 class S(str):
1409 def __eq__(self, other):
1410 raise ValueError("should not be called")
1411
1412 a, b = S("foobar"), S("foobar")
1413 self.assert_digest_equal(a, b)
1414 a, b = S("foobar"), "foobar"
1415 self.assert_digest_equal(a, b)
1416 a, b = S("foobar"), S("foobaz")
1417 self.assert_digest_not_equal(a, b)
1418
1419 def test_bytes_subclass(self):
1420 class B(bytes):

Callers

nothing calls this directly

Calls 3

assert_digest_equalMethod · 0.95
SClass · 0.70

Tested by

no test coverage detected