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

Unified Diff: Lib/test/test_types.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 8 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_trace.py ('k') | Lib/test/test_unicode_file.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_types.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_types.py Fri Feb 07 23:40:05 2014 +0200
@@ -624,8 +624,8 @@
self.assertEqual(view.get('x'), 1)
self.assertEqual(view.get('y'), None)
self.assertEqual(view.get('y', 42), 42)
- self.assertTrue('x' in view)
- self.assertFalse('y' in view)
+ self.assertIn('x', view)
+ self.assertNotIn('y', view)
def test_customdict(self):
class customdict(dict):
@@ -661,9 +661,9 @@
custom = customdict({'key': 'value'})
view = self.mappingproxy(custom)
- self.assertTrue('key' in view)
- self.assertTrue('magic' in view)
- self.assertFalse('xxx' in view)
+ self.assertIn('key', view)
+ self.assertIn('magic', view)
+ self.assertNotIn('xxx', view)
self.assertEqual(view['key'], 'getitem=value')
self.assertRaises(KeyError, view.__getitem__, 'xxx')
self.assertEqual(tuple(view), ('iter',))
@@ -680,9 +680,9 @@
d2 = {'y': 2}
mapping = collections.ChainMap(d1, d2)
view = self.mappingproxy(mapping)
- self.assertTrue('x' in view)
- self.assertTrue('y' in view)
- self.assertFalse('z' in view)
+ self.assertIn('x', view)
+ self.assertIn('y', view)
+ self.assertNotIn('z', view)
self.assertEqual(view['x'], 1)
self.assertEqual(view['y'], 2)
self.assertRaises(KeyError, view.__getitem__, 'z')
@@ -701,10 +701,10 @@
def test_contains(self):
view = self.mappingproxy(dict.fromkeys('abc'))
- self.assertTrue('a' in view)
- self.assertTrue('b' in view)
- self.assertTrue('c' in view)
- self.assertFalse('xxx' in view)
+ self.assertIn('a', view)
+ self.assertIn('b', view)
+ self.assertIn('c', view)
+ self.assertNotIn('xxx', view)
def test_views(self):
mapping = {}
« no previous file with comments | « Lib/test/test_trace.py ('k') | Lib/test/test_unicode_file.py » ('j') | no next file with comments »

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