[Python-Dev] cpython: Prefer assertEqual to simply assert per recommendation in issue6727. (original) (raw)

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/testimport.py | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Lib/test/testimport.py b/Lib/test/testimport.py --- a/Lib/test/testimport.py +++ b/Lib/test/testimport.py @@ -707,14 +707,19 @@ os.mkdir(self.tagged) initfile = os.path.join(self.tagged, 'init.py') open(initfile, 'w').close() - assert os.path.exists(initfile) + self.assertEqual(os.path.exists(initfile), True) # now create a symlink to the tagged package # sample -> sample-tagged os.symlink(self.tagged, self.packagename) - # assert os.path.isdir(self.packagename) # currently fails - assert os.path.isfile(os.path.join(self.packagename, 'init.py')) + # disabled because os.isdir currently fails (see issue 15093) + # self.assertEqual(os.path.isdir(self.packagename), True) + + self.assertEqual( + os.path.isfile(os.path.join(self.packagename, 'init.py')), + True, + )

Actually, in this case self.assertTrue() is the correct method.

cheers, Georg



More information about the Python-Dev mailing list