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

Method test_unequal

Lib/test/test_secrets.py:26–34  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

24 self.assertTrue(secrets.compare_digest(a.encode('utf-8'), b.encode('utf-8')))
25
26 def test_unequal(self):
27 # Test compare_digest functionality with unequal (byte/text) strings.
28 self.assertFalse(secrets.compare_digest("abc", "abcd"))
29 self.assertFalse(secrets.compare_digest(b"abc", b"abcd"))
30 for s in ("x", "mn", "a1b2c3"):
31 a = s*100 + "q"
32 b = s*100 + "k"
33 self.assertFalse(secrets.compare_digest(a, b))
34 self.assertFalse(secrets.compare_digest(a.encode('utf-8'), b.encode('utf-8')))
35
36 def test_bad_types(self):
37 # Test that compare_digest raises with mixed types.

Callers

nothing calls this directly

Calls 3

assertFalseMethod · 0.80
compare_digestMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected