def test_clean(self): class DummyContent(object): def content(self): return "content" f = ParentField(str) f.parent = DummyContent() assert f.clean("") == "content"
def test_clean_mistype(self): f = ParentField(str) f.parent = mock.MagicMock() with pytest.raises(forms.ValidationError): f.clean("")