예제 #1
0
    def test_clean(self):
        class DummyContent(object):
            def content(self):
                return "content"

        f = ParentField(str)
        f.parent = DummyContent()

        assert f.clean("") == "content"
예제 #2
0
 def test_clean_mistype(self):
     f = ParentField(str)
     f.parent = mock.MagicMock()
     with pytest.raises(forms.ValidationError):
         f.clean("")