44import pytest
55from tests .views .fake_components import (
66 FakeAuthenticationComponent ,
7+ FakeFormClassesComponent ,
78 FakeValidationComponent ,
89)
910
1011from django_unicorn .components import UnicornView
1112from django_unicorn .serializer import InvalidFieldNameError
13+ from example .books .models import Book
1214
1315
1416class ExampleComponent (UnicornView ):
@@ -358,7 +360,6 @@ def test_form_classes_validate_all_fields_with_empty_object():
358360 title or date_published, calling ``validate()`` should populate errors for
359361 both ``book.title`` and ``book.date_published``.
360362 """
361- from tests .views .fake_components import FakeFormClassesComponent
362363
363364 component = FakeFormClassesComponent (component_id = "test_form_classes_validate_all" , component_name = "example" )
364365
@@ -375,7 +376,6 @@ def test_form_classes_validate_model_names_filtered():
375376 When ``model_names`` is specified, only the requested dotted keys should
376377 appear in the errors dict.
377378 """
378- from tests .views .fake_components import FakeFormClassesComponent
379379
380380 component = FakeFormClassesComponent (component_id = "test_form_classes_filtered" , component_name = "example" )
381381
@@ -387,7 +387,6 @@ def test_form_classes_validate_model_names_filtered():
387387
388388def test_form_classes_is_valid_with_empty_object ():
389389 """``is_valid()`` should return ``False`` when required object fields are missing."""
390- from tests .views .fake_components import FakeFormClassesComponent
391390
392391 component = FakeFormClassesComponent (component_id = "test_form_classes_is_valid_false" , component_name = "example" )
393392
@@ -399,9 +398,6 @@ def test_form_classes_validate_stale_errors_removed():
399398 Errors for an object field that has since become valid should be removed on
400399 the next ``validate()`` call.
401400 """
402- from tests .views .fake_components import FakeFormClassesComponent
403-
404- from example .books .models import Book
405401
406402 component = FakeFormClassesComponent (component_id = "test_form_classes_stale_errors" , component_name = "example" )
407403
0 commit comments