MCPcopy
hub / github.com/django/django / test_field_with_no_errors

Method test_field_with_no_errors

tests/test_utils/tests.py:1531–1543  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1529 )
1530
1531 def test_field_with_no_errors(self):
1532 msg = (
1533 "The errors of field 'field' on form <TestForm bound=True, valid=True, "
1534 "fields=(field)> don't match."
1535 )
1536 with self.assertRaisesMessage(AssertionError, msg) as ctx:
1537 self.assertFormError(TestForm.valid(), "field", "invalid value")
1538 self.assertIn("[] != ['invalid value']", str(ctx.exception))
1539 msg_prefix = "Custom prefix"
1540 with self.assertRaisesMessage(AssertionError, f"{msg_prefix}: {msg}"):
1541 self.assertFormError(
1542 TestForm.valid(), "field", "invalid value", msg_prefix=msg_prefix
1543 )
1544
1545 def test_field_with_different_error(self):
1546 msg = (

Callers

nothing calls this directly

Calls 3

assertRaisesMessageMethod · 0.80
assertFormErrorMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected