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

Unified Diff: Lib/test/test_configparser.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_concurrent_futures.py ('k') | Lib/test/test_copyreg.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_configparser.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_configparser.py Fri Feb 07 23:40:05 2014 +0200
@@ -266,20 +266,20 @@
# mapping access
del cf['Types']
- self.assertFalse('Types' in cf)
+ self.assertNotIn('Types', cf)
with self.assertRaises(KeyError):
del cf['Types']
with self.assertRaises(ValueError):
del cf[self.default_section]
del cf['Spacey Bar']['foo']
- self.assertFalse('foo' in cf['Spacey Bar'])
+ self.assertNotIn('foo', cf['Spacey Bar'])
with self.assertRaises(KeyError):
del cf['Spacey Bar']['foo']
- self.assertTrue('that_value' in cf['Spacey Bar'])
+ self.assertIn('that_value', cf['Spacey Bar'])
with self.assertRaises(KeyError):
del cf['Spacey Bar']['that_value']
del cf[self.default_section]['that_value']
- self.assertFalse('that_value' in cf['Spacey Bar'])
+ self.assertNotIn('that_value', cf['Spacey Bar'])
with self.assertRaises(KeyError):
del cf[self.default_section]['that_value']
with self.assertRaises(KeyError):
@@ -484,7 +484,7 @@
with self.assertRaises(KeyError):
# section names are case-sensitive
cf["b"]["A"] = "value"
- self.assertTrue("b" in cf["a"])
+ self.assertIn("b", cf["a"])
cf["A"]["A-B"] = "A-B value"
for opt in ("a-b", "A-b", "a-B", "A-B"):
self.assertTrue(
@@ -506,7 +506,7 @@
cf = self.fromstring("[section]\n"
"nekey{}nevalue\n".format(self.delimiters[0]),
defaults={"key":"value"})
- self.assertTrue("Key" in cf["section"])
+ self.assertIn("Key", cf["section"])
def test_default_case_sensitivity(self):
cf = self.newconfig({"foo": "Bar"})
@@ -1536,7 +1536,7 @@
error.filename = 'filename'
self.assertEqual(error.source, 'filename')
for warning in w:
- self.assertTrue(warning.category is DeprecationWarning)
+ self.assertIs(warning.category, DeprecationWarning)
def test_interpolation_validation(self):
parser = configparser.ConfigParser()
@@ -1565,7 +1565,7 @@
warnings.simplefilter("always", DeprecationWarning)
parser.readfp(sio, filename='StringIO')
for warning in w:
- self.assertTrue(warning.category is DeprecationWarning)
+ self.assertIs(warning.category, DeprecationWarning)
self.assertEqual(len(parser), 2)
self.assertEqual(parser['section']['option'], 'value')
@@ -1574,7 +1574,7 @@
warnings.simplefilter("always", DeprecationWarning)
parser = configparser.SafeConfigParser()
for warning in w:
- self.assertTrue(warning.category is DeprecationWarning)
+ self.assertIs(warning.category, DeprecationWarning)
def test_sectionproxy_repr(self):
parser = configparser.ConfigParser()
« no previous file with comments | « Lib/test/test_concurrent_futures.py ('k') | Lib/test/test_copyreg.py » ('j') | no next file with comments »

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