MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_string_subclass

Method test_string_subclass

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

Source from the content-addressed store, hash-verified

1451 self.assert_digest_not_equal(a, b)
1452
1453 def test_string_subclass(self):
1454 class S(str):
1455 def __eq__(self, other):
1456 raise ValueError("should not be called")
1457
1458 a, b = S("foobar"), S("foobar")
1459 self.assert_digest_equal(a, b)
1460 a, b = S("foobar"), "foobar"
1461 self.assert_digest_equal(a, b)
1462 a, b = S("foobar"), S("foobaz")
1463 self.assert_digest_not_equal(a, b)
1464
1465 def test_bytes_subclass(self):
1466 class B(bytes):

Callers

nothing calls this directly

Calls 3

assert_digest_equalMethod · 0.95
SClass · 0.70

Tested by

no test coverage detected