Skip to content

Commit

Permalink
Merge pull request jazzband#24 from onepercentclub/port-regression-do…
Browse files Browse the repository at this point in the history
…ctest-to-unit-test

Port regression doctest to unit test
  • Loading branch information
chrisglass committed Mar 25, 2013
2 parents 60c1d43 + 8e4697c commit 30172d3
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions polymorphic/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,22 +618,30 @@ def show_base_manager(model):
#>>> print 'DiamondXY fields 1: field_b "%s", field_x "%s", field_y "%s"' % (o.field_b, o.field_x, o.field_y)
#DiamondXY fields 1: field_b "a", field_x "x", field_y "y"
# test for github issue
>>> t = Top()
>>> t.save()
>>> m = Middle()
>>> m.save()
>>> b = Bottom()
>>> b.save()
>>> Top.objects.all()
[<Top: Top object>, <Middle: Middle object>, <Bottom: Bottom object>]
>>> Middle.objects.all()
[<Middle: Middle object>, <Bottom: Bottom object>]
>>> Bottom.objects.all()
[<Bottom: Bottom object>]
>>> settings.DEBUG=False
"""}


class RegressionTests(TestCase):

def test_for_query_result_incomplete_with_inheritance(self):
""" https://github.com/bconstantin/django_polymorphic/issues/15 """

top = Top()
top.save()
middle = Middle()
middle.save()
bottom = Bottom()
bottom.save()

expected_queryset = [top, middle, bottom]
self.assertQuerysetEqual(Top.objects.all(), [repr(r) for r in expected_queryset])

expected_queryset = [middle, bottom]
self.assertQuerysetEqual(Middle.objects.all(), [repr(r) for r in expected_queryset])

expected_queryset = [bottom]
self.assertQuerysetEqual(Bottom.objects.all(), [repr(r) for r in expected_queryset])

0 comments on commit 30172d3

Please sign in to comment.