[Python-Dev] cpython: Prefer assertEqual to simply assert per recommendation in issue6727.
Georg Brandl
g.brandl at gmx.net
Wed Jun 20 17:37:52 CEST 2012
Am 20.06.2012 16:25, schrieb jason.coombs:
> http://hg.python.org/cpython/rev/24369f6c4a22
> changeset: 77525:24369f6c4a22
> user: Jason R. Coombs <jaraco at jaraco.com>
> date: Wed Jun 20 10:24:24 2012 -0400
> summary:
> Prefer assertEqual to simply assert per recommendation in issue6727.
> Clarified comment on disabled code to reference issue15093.
>
> files:
> Lib/test/test_import.py | 11 ++++++++---
> 1 files changed, 8 insertions(+), 3 deletions(-)
>
>
> diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
> --- a/Lib/test/test_import.py
> +++ b/Lib/test/test_import.py
> @@ -707,14 +707,19 @@
> os.mkdir(self.tagged)
> init_file = os.path.join(self.tagged, '__init__.py')
> open(init_file, 'w').close()
> - assert os.path.exists(init_file)
> + self.assertEqual(os.path.exists(init_file), True)
>
> # now create a symlink to the tagged package
> # sample -> sample-tagged
> os.symlink(self.tagged, self.package_name)
>
> - # assert os.path.isdir(self.package_name) # currently fails
> - assert os.path.isfile(os.path.join(self.package_name, '__init__.py'))
> + # disabled because os.isdir currently fails (see issue 15093)
> + # self.assertEqual(os.path.isdir(self.package_name), True)
> +
> + self.assertEqual(
> + os.path.isfile(os.path.join(self.package_name, '__init__.py')),
> + True,
> + )
Actually, in this case self.assertTrue() is the correct method.
cheers,
Georg
More information about the Python-Dev
mailing list