... is both a foreign and primary key ( #24951 ). Fixed AssertionError in some complex queries ( #24525 ). Fixed a migrations crash with GenericForeignKey ( #25040 ). Made translation.override( ... ... tial data in model forms from being affected by subsequent model changes ( #28543 ). Fixed non-deterministic results or an AssertionError crash in some queries with multiple joins ( #26522 ). Fixed a regression in contrib.auth 's login() and logout() views whe ... ... .urls property, or AdminSite.get_urls() method. Unsupported operations on a sliced queryset now raise TypeError instead of AssertionError . The undocumented django.test.runner.reorder_suite() function is renamed to reorder_tests() . It now accepts an iterable ... , and returns an iterator of tests. Calling FileSystemStorage.delete() with an empty name now raises ValueError instead of AssertionError . Calling EmailMultiAlternatives.attach_alternative() or EmailMessage.attach() with an invalid content or mimetype argumen ... ts now raise ValueError instead of AssertionError . assertHTMLEqual() no longer considers a non-boolean attribute without a value equal to an attribute with the same name a ... ... $" Smaller model changes Different exception from get() Managers now return a MultipleObjectsReturned exception instead of AssertionError : Old (0.96): try : Model . objects . get ( ... ) except AssertionError : handle_the_error () New (1.0): try : Model . obj ... ... (例を参照)。 同じ文字を参照するテキスト、文字参照、およびエンティティ参照は等価です。 以下の例は有効なテストであり、どれも AssertionError を引き起こしません。 self . assertHTMLEqual ( "<p>Hello <b>'world'!</p>" , """<p> Hello <b>'world'! </b> ... ccept_terms" type="checkbox" checked>' , ) html1 と html2 はHTMLを含んでいなければなりません。どちらかが解析できない場合は AssertionError が発生します。 エラー時の出力は msg 引数でカスタマイズできます。 SimpleTestCase. assertHTMLNotEqual ( html1 , html2 , msg ... 細は assertHTMLEqual() を参照してください。 html1 と html2 はHTMLを含んでいなければなりません。どちらかが解析できない場合は AssertionError が発生します。 エラー時の出力は msg 引数でカスタマイズできます。 SimpleTestCase. assertXMLEqual ( xml1 , xml2 , msg = None ... ... >>> t = Template ( "My name is {{ person.first_name }}." ) >>> class PersonClass3 : ... def first_name ( self ): ... raise AssertionError ( "foo" ) ... >>> p = PersonClass3 () >>> t . render ( Context ({ "person" : p })) Traceback (most recent call last): ... ... AssertionError : foo >>> class SilentAssertionError ( Exception ): ... silent_variable_failure = True ... >>> class PersonClass4 : ... def first_name ( self ): ... raise Sile ... ntAssertionError ... >>> p = PersonClass4 () >>> t . render ( Context ({ "person" : p })) "My name is ." django.core.exceptions.ObjectDoesN ... ... line 16 , in test_was_published_recently_with_future_poll self.assertIs ( future_poll.was_published_recently () , False ) AssertionError: True is not False ---------------------------------------------------------------------- Ran 1 test in 0 .003s FAILED ( f ... ... , in test_was_published_recently_with_future_question self.assertIs ( future_question.was_published_recently () , False ) AssertionError: True is not False ---------------------------------------------------------------------- Ran 1 test in 0 .001s FAILED ( f ... 2026年10月08日