MCPcopy
hub / github.com/django/django / test_clean_false

Method test_clean_false

tests/model_forms/tests.py:2494–2502  ·  view source on GitHub ↗

If the ``clean`` method on a non-required FileField receives False as the data (meaning clear the field value), it returns False, regardless of the value of ``initial``.

(self)

Source from the content-addressed store, hash-verified

2492 self.addCleanup(shutil.rmtree, temp_storage_dir)
2493
2494 def test_clean_false(self):
2495 """
2496 If the ``clean`` method on a non-required FileField receives False as
2497 the data (meaning clear the field value), it returns False, regardless
2498 of the value of ``initial``.
2499 """
2500 f = forms.FileField(required=False)
2501 self.assertIs(f.clean(False), False)
2502 self.assertIs(f.clean(False, "initial"), False)
2503
2504 def test_clean_false_required(self):
2505 """

Callers

nothing calls this directly

Calls 1

cleanMethod · 0.95

Tested by

no test coverage detected