Skip to content

Commit 96be52e

Browse files
committed
Fixed some tests
1 parent 7705041 commit 96be52e

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

lib/iommi/from_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def member_from_model(cls, model, factory_lookup, defaults_factory, factory_look
108108
break # pragma: no mutate optimization
109109

110110
if factory is MISSING:
111-
message = 'No factory for %s.' % type(model_field)
111+
message = f'No factory for {type(model_field).__name__}.'
112112
if factory_lookup_register_function is not None:
113113
message += ' Register a factory with %s, you can also register one that returns None to not handle this field type' % factory_lookup_register_function.__name__
114114
raise AssertionError(message)

tests/test_40_forms.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -786,11 +786,7 @@ class FooModel(Model):
786786
with pytest.raises(AssertionError) as error:
787787
Field.from_model(FooModel, 'foo')
788788

789-
acceptable_error_messages = [
790-
"No factory for <class 'tests.test_forms.CustomField'>. Register a factory with register_field_factory, you can also register one that returns None to not handle this field type",
791-
"No factory for <class 'tests.test_forms.test_field_from_model_factory_error_message.<locals>.CustomField'>. Register a factory with register_field_factory, you can also register one that returns None to not handle this field type",
792-
]
793-
assert str(error.value) in acceptable_error_messages
789+
assert str(error.value) == "No factory for CustomField. Register a factory with register_field_factory, you can also register one that returns None to not handle this field type"
794790

795791

796792
@pytest.mark.django

tests/test_99_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def shortcut3(cls, call_target):
106106
* `name`
107107
* `foo-name`
108108
* `some_other_thing`
109-
* `tests.test_docs.some_callable`
109+
* `tests.test_99_docs.some_callable`
110110
111111
Shortcuts
112112
---------

0 commit comments

Comments
 (0)