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

Unified Diff: Lib/distutils/tests/test_build_ext.py

Issue 19600: Use specific asserts in distutils tests
Patch Set: Created 6 years 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
--- a/Lib/distutils/tests/test_build_ext.py Thu Nov 14 23:50:51 2013 +0200
+++ b/Lib/distutils/tests/test_build_ext.py Fri Nov 15 09:27:30 2013 +0200
@@ -76,8 +76,8 @@
if support.HAVE_DOCSTRINGS:
doc = 'This is a template module just for instruction.'
self.assertEqual(xx.__doc__, doc)
- self.assertTrue(isinstance(xx.Null(), xx.Null))
- self.assertTrue(isinstance(xx.Str(), xx.Str))
+ self.assertIsInstance(xx.Null(), xx.Null)
+ self.assertIsInstance(xx.Str(), xx.Str)
def tearDown(self):
# Get everything back to normal
@@ -110,7 +110,7 @@
_config_vars['Py_ENABLE_SHARED'] = old_var
# make sure we get some library dirs under solaris
- self.assertTrue(len(cmd.library_dirs) > 0)
+ self.assertGreater(len(cmd.library_dirs), 0)
def test_user_site(self):
# site.USER_SITE was introduced in 2.6
@@ -124,7 +124,7 @@
# making sure the user option is there
options = [name for name, short, lable in
cmd.user_options]
- self.assertTrue('user' in options)
+ self.assertIn('user', options)
# setting a value
cmd.user = 1
@@ -171,10 +171,10 @@
from distutils import sysconfig
py_include = sysconfig.get_python_inc()
- self.assertTrue(py_include in cmd.include_dirs)
+ self.assertIn(py_include, cmd.include_dirs)
plat_py_include = sysconfig.get_python_inc(plat_specific=1)
- self.assertTrue(plat_py_include in cmd.include_dirs)
+ self.assertIn(plat_py_include, cmd.include_dirs)
# make sure cmd.libraries is turned into a list
# if it's a string
@@ -255,13 +255,13 @@
'some': 'bar'})]
cmd.check_extensions_list(exts)
ext = exts[0]
- self.assertTrue(isinstance(ext, Extension))
+ self.assertIsInstance(ext, Extension)
# check_extensions_list adds in ext the values passed
# when they are in ('include_dirs', 'library_dirs', 'libraries'
# 'extra_objects', 'extra_compile_args', 'extra_link_args')
self.assertEqual(ext.libraries, 'foo')
- self.assertTrue(not hasattr(ext, 'some'))
+ self.assertFalse(hasattr(ext, 'some'))
# 'macros' element of build info dict must be 1- or 2-tuple
exts = [('foo.bar', {'sources': [''], 'libraries': 'foo',

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