コード例 #1
0
ファイル: test_models.py プロジェクト: TroJan/fjord
 def test_to_python(self):
     tests = [
         # test data, expected
         (None, []),
         ([], []),
         ([1, 2, 3], [1, 2, 3]),
         (u'[1, 2, 3]', [1, 2, 3]),
         (u"[u'a', u'b', u'c']", [u'a', u'b', u'c'])
     ]
     field = ListField()
     for testcase, expected in tests:
         assert field.to_python(testcase) == expected
コード例 #2
0
ファイル: test_models.py プロジェクト: xrile/fjord
 def test_to_python(self):
     tests = [
         # test data, expected
         (None, []),
         ([], []),
         ([1, 2, 3], [1, 2, 3]),
         (u'[1, 2, 3]', [1, 2, 3]),
         (u"[u'a', u'b', u'c']", [u'a', u'b', u'c'])
     ]
     field = ListField()
     for testcase, expected in tests:
         assert field.to_python(testcase) == expected
コード例 #3
0
ファイル: test_models.py プロジェクト: xrile/fjord
 def test_to_python_raises_validationerror_on_syntaxerror(self):
     field = ListField()
     with pytest.raises(ValidationError):
         field.to_python('abc')
コード例 #4
0
ファイル: test_models.py プロジェクト: xrile/fjord
 def test_to_python_non_list_raises_validationerror_on_assert(self):
     field = ListField()
     with pytest.raises(ValidationError):
         field.to_python(42)