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

Method test_bytes

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

Source from the content-addressed store, hash-verified

1347 self.assertRaises(TypeError, self.compare_digest, b, a)
1348
1349 def test_bytes(self):
1350 # Testing bytes of different lengths
1351 a, b = b"foobar", b"foo"
1352 self.assert_digest_not_equal(a, b)
1353 a, b = b"\xde\xad\xbe\xef", b"\xde\xad"
1354 self.assert_digest_not_equal(a, b)
1355
1356 # Testing bytes of same lengths, different values
1357 a, b = b"foobar", b"foobaz"
1358 self.assert_digest_not_equal(a, b)
1359 a, b = b"\xde\xad\xbe\xef", b"\xab\xad\x1d\xea"
1360 self.assert_digest_not_equal(a, b)
1361
1362 # Testing bytes of same lengths, same values
1363 a, b = b"foobar", b"foobar"
1364 self.assert_digest_equal(a, b)
1365 a, b = b"\xde\xad\xbe\xef", b"\xde\xad\xbe\xef"
1366 self.assert_digest_equal(a, b)
1367
1368 def test_bytearray(self):
1369 # Testing bytearrays of same lengths, same values

Callers

nothing calls this directly

Calls 2

assert_digest_equalMethod · 0.95

Tested by

no test coverage detected