I can't work this one out. I have a blind spot. Any help appreciated.
My unit tests indicate a problem with the following method (is_current)
on a model. Because I couldn't figure it out I instrumented with a whole
mess of print statements. The problem occurs on the line with
self.quality_tag. Note the print statement before and after ...
def is_current(self):
current = self.effective and self.effective <= when()
print('\n%s %s - when = %s' %(current, self.effective, when()))
print('\n%s - 1 quality_tag = %s' % (current, self.quality_tag))
current = current and (self.quality_tag is None)
print('\n%s - 2 quality_tag = %s' % (current, self.quality_tag))
current = current and not self.withdrawn
print('\n%s - withdrawn = %s' %(current, self.withdrawn))
return current
Here is the unit test output ... which seems to indicate there is a bug
in (my) boolean logic where (self.quality_tag is None) returns False
instead of True when self.quality_tag really *is* None
True 2013-06-07 03:18:14.418000+00:00 - when = 2013-06-07
03:18:15.231000+00:00
True - 1 quality_tag = None
False - 2 quality_tag = None
False - withdrawn = False
F
======================================================================
FAIL: test_attach_current (items.tests.test_utils.TestAttach)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\users\miked\py\xxx_project\xxx\items\tests\test_utils.py",
line 272, in test_attach_current
self.assertEqual(obj.is_current(), True)
AssertionError: False != True
----------------------------------------------------------------------
Windows XP
Python 2.7
Django 1.5
Thanks
Mike
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.