Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(272453)

Unified Diff: Lib/test/test_hmac.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_gzip.py ('k') | Lib/test/test_inspect.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_hmac.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_hmac.py Fri Feb 07 23:40:05 2014 +0200
@@ -357,7 +357,7 @@
# Testing if attributes are of same type.
h1 = hmac.HMAC(b"key", digestmod="md5")
h2 = h1.copy()
- self.assertTrue(h1.digest_cons == h2.digest_cons,
+ self.assertEqual(h1.digest_cons, h2.digest_cons,
"digest constructors don't match.")
self.assertEqual(type(h1.inner), type(h2.inner),
"Types of inner don't match.")
@@ -368,11 +368,11 @@
# Testing if the copy method created a real copy.
h1 = hmac.HMAC(b"key", digestmod="md5")
h2 = h1.copy()
- # Using id() in case somebody has overridden __eq__/__ne__.
- self.assertTrue(id(h1) != id(h2), "No real copy of the HMAC instance.")
- self.assertTrue(id(h1.inner) != id(h2.inner),
+ # Using "is" in case somebody has overridden __eq__/__ne__.
+ self.assertIsNot(h1, h2, "No real copy of the HMAC instance.")
+ self.assertIsNot(h1.inner, h2.inner,
"No real copy of the attribute 'inner'.")
- self.assertTrue(id(h1.outer) != id(h2.outer),
+ self.assertIsNot(h1.outer, h2.outer,
"No real copy of the attribute 'outer'.")
def test_equality(self):
« no previous file with comments | « Lib/test/test_gzip.py ('k') | Lib/test/test_inspect.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+