[docs] Code, test, and doc review for PEP-0435 Enum (issue 17947)

ezio.melotti at gmail.com ezio.melotti at gmail.com
Fri May 10 20:34:34 CEST 2013


http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py
File Lib/test/test_enum.py (right):

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode54
Lib/test/test_enum.py:54: class Test_Enum(unittest.TestCase):
TestEnum

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode100
Lib/test/test_enum.py:100: self.assertTrue(type(e) is Season)
assertIs

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode164
Lib/test/test_enum.py:164: self.assertEqual([k for k,v in
Season.__members__.items() if v.name != k], ['FALL', 'ANOTHER_SPRING'])
Line too long.

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode174
Lib/test/test_enum.py:174: self.assertTrue(type(Huh.name) is Huh)
assertIs

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode216
Lib/test/test_enum.py:216: self.assertTrue(WeekDay.TEUSDAY is
WeekDay.TUESDAY)
assertIs

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode218
Lib/test/test_enum.py:218: self.assertEqual([k for k,v in
WeekDay.__members__.items() if v.name != k], ['TEUSDAY', ])
Line too long.

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode227
Lib/test/test_enum.py:227: self.assertTrue(FloatStooges.CURLY is
loads(dumps(FloatStooges.CURLY)))
There are more assertTrue that should be converted to assertIs and
others.  In general assertTrue/False should be avoided if possible or a
message should be added, otherwise in case of failure, a non-informative
"False is not true" will be reported.

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode377
Lib/test/test_enum.py:377: self.assertFalse(type(whatever.really) is
whatever)
assertIsNot

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode389
Lib/test/test_enum.py:389: self.assertFalse(Why.question in Why)
assertNotIn

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode534
Lib/test/test_enum.py:534: if isinstance( self, NamedInt ) and
isinstance( other, NamedInt ):
There are extra spaces here.

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode543
Lib/test/test_enum.py:543: y = ('the-y', 2 )
Here too.

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode556
Lib/test/test_enum.py:556: self.assertTrue(isinstance(SomeTuple.second,
tuple))
assertIsInstance

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode559
Lib/test/test_enum.py:559:
self.assertTrue(loads(dumps(SomeTuple.first)), SomeTuple.first)
I think you want an assertIs here too (as it is, SomeTuple.first is the
error message).

http://bugs.python.org/review/17947/diff/8110/Lib/test/test_enum.py#newcode634
Lib/test/test_enum.py:634: self.assertTrue(Grade.B >= Grade.B)
You can use assertGreater and friends here.

http://bugs.python.org/review/17947/


More information about the docs mailing list