You know you're spending too much time on the 'net when...

by jesse in ,


You accidentally start typing "False" as Fail - and don't notice it until some stupid unit test bombs out: ERROR: test_someCoolMethod (__main__.TestScenarios) ---------------------------------------------------------------------- Traceback (most recent call last): File "mysillytests.py", line 83, in test_someCoolMethod self.assertEqual(resp, Fail) NameError: global name 'Fail' is not defined

I need to make two knew types: Fail and Win. Too bad the bool class can't be sub classed. I think a win and fail type would make things so much better:

If var is Fail: ... elif var is Win: ...

if var is not Win:

Maybe I need stop writing unit tests and go to bed.

Edit to add: Doug helped me out: Python 2.5.1 (r251:54863, Oct 5 2007, 21:08:09) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> __builtins__.Fail=False >>> __builtins__.Win=True >>> >>> x = Win >>> y = Fail >>> >>> not x False >>> not y True >>> y is Win False >>> x is Win True >>>

Now all I have to do is add this to my sitecustomize.py and really trip up my teammates.