55from __future__ import annotations
66
77import inspect
8- from typing import TYPE_CHECKING
98
109import django .test
1110import pytest
1615from pytest_django .asserts import __all__ as asserts_all
1716
1817
19- if TYPE_CHECKING :
20- import django .test
21-
22-
2318def _get_actual_assertions_names () -> list [str ]:
2419 """
2520 Returns list with names of all assertion helpers in Django.
@@ -81,23 +76,23 @@ def test_sanity() -> None:
8176 assert assertContains .__doc__
8277
8378
84- def test_real_assert (django_testcase : django .test .TestCase ) -> None :
79+ def test_fixture_assert (django_testcase : django .test .TestCase ) -> None :
8580 django_testcase .assertEqual ("a" , "a" ) # noqa: PT009
8681
8782 with pytest .raises (AssertionError ):
8883 django_testcase .assertXMLEqual ("a" * 10_000 , "a" )
8984
9085
9186class TestDjangoAssert (django .test .TestCase ):
92- def test_real_assert (django_testcase : django .test .TestCase ) -> None :
87+ def test_fixture_assert (django_testcase : django .test .TestCase ) -> None :
9388 django_testcase .assertEqual ("a" , "a" ) # noqa: PT009
9489
9590 with pytest .raises (AssertionError ):
9691 django_testcase .assertXMLEqual ("a" * 10_000 , "a" )
9792
9893
9994class TestInternalDjangoAssert :
100- def test_real_assert (self , django_testcase : django .test .TestCase ) -> None :
95+ def test_fixture_assert (self , django_testcase : django .test .TestCase ) -> None :
10196 django_testcase .assertEqual ("a" , "a" ) # noqa: PT009
10297 assert not hasattr (self , "assertEqual" )
10398
@@ -112,10 +107,13 @@ def test_unittest_assert(django_pytester: DjangoPytester) -> None:
112107 import unittest
113108
114109 class TestUnittestAssert(unittest.TestCase):
115- def test_real_assert (self, django_testcase: unittest.TestCase) -> None:
110+ def test_fixture_assert (self, django_testcase: unittest.TestCase) -> None:
116111 assert False
112+
113+ def test_normal_assert(self) -> None:
114+ self.assertEqual("a", "a")
117115 """
118116 )
119117 result = django_pytester .runpytest_subprocess ()
120- result .assert_outcomes (failed = 1 )
118+ result .assert_outcomes (failed = 1 , passed = 1 )
121119 assert "missing 1 required positional argument: 'django_testcase'" in result .stdout .str ()
0 commit comments