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

Side by Side Diff: Lib/test/test_crypt.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 6 years ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « Lib/test/test_copyreg.py ('k') | Lib/test/test_dbm_gnu.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 from test import support 1 from test import support
2 import unittest 2 import unittest
3 3
4 def setUpModule(): 4 def setUpModule():
5 # this import will raise unittest.SkipTest if _crypt doesn't exist, 5 # this import will raise unittest.SkipTest if _crypt doesn't exist,
6 # so it has to be done in setUpModule for test discovery to work 6 # so it has to be done in setUpModule for test discovery to work
7 global crypt 7 global crypt
8 crypt = support.import_module('crypt') 8 crypt = support.import_module('crypt')
9 9
10 class CryptTestCase(unittest.TestCase): 10 class CryptTestCase(unittest.TestCase):
(...skipping 12 matching lines...) Expand all
23 23
24 def test_saltedcrypt(self): 24 def test_saltedcrypt(self):
25 for method in crypt.methods: 25 for method in crypt.methods:
26 pw = crypt.crypt('assword', method) 26 pw = crypt.crypt('assword', method)
27 self.assertEqual(len(pw), method.total_size) 27 self.assertEqual(len(pw), method.total_size)
28 pw = crypt.crypt('assword', crypt.mksalt(method)) 28 pw = crypt.crypt('assword', crypt.mksalt(method))
29 self.assertEqual(len(pw), method.total_size) 29 self.assertEqual(len(pw), method.total_size)
30 30
31 def test_methods(self): 31 def test_methods(self):
32 # Gurantee that METHOD_CRYPT is the last method in crypt.methods. 32 # Gurantee that METHOD_CRYPT is the last method in crypt.methods.
33 self.assertTrue(len(crypt.methods) >= 1) 33 self.assertGreaterEqual(len(crypt.methods), 1)
34 self.assertEqual(crypt.METHOD_CRYPT, crypt.methods[-1]) 34 self.assertEqual(crypt.METHOD_CRYPT, crypt.methods[-1])
35 35
36 if __name__ == "__main__": 36 if __name__ == "__main__":
37 unittest.main() 37 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_copyreg.py ('k') | Lib/test/test_dbm_gnu.py » ('j') | no next file with comments »

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