Ticket #23940: tests_ticket23940.patch

File tests_ticket23940.patch, 942 bytes (added by Baptiste Mispelon, 10 years ago)

Tests for reproducing the issue

  • new file tests/bug23940/models.py

    diff --git a/tests/bug23940/__init__.py b/tests/bug23940/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/bug23940/models.py b/tests/bug23940/models.py
    new file mode 100644
    index 0000000..644a613
    - +  
     1from django.db import models
     2
     3class Foo(models.Model):
     4    # Changing the name of this field to anything else makes the test pass
     5    exact = models.BooleanField(default=False)
     6
     7
     8class Bar(models.Model):
     9    foo = models.ForeignKey('Foo')
  • new file tests/bug23940/tests.py

    diff --git a/tests/bug23940/tests.py b/tests/bug23940/tests.py
    new file mode 100644
    index 0000000..8efe68a
    - +  
     1from django.test import TestCase
     2
     3from .models import Foo, Bar
     4
     5class FooTestCase(TestCase):
     6    def test_foo(self):
     7        f = Foo.objects.create()
     8        b = Bar.objects.create(foo=f)
     9        self.assertEqual(f.bar_set.count(), 1)
Back to Top