コード例 #1
0
ファイル: test_models.py プロジェクト: sarahquigley/smp_api
 def test_word_text_should_be_invalid(self):
     # Test that Word model text with spaces or non-letter characters
     # (other than hyphen) is invalid
     # This test could possibly be made more thorough
     invalid = ['a b', ' a', 'a ', '$', '%']
     for text in invalid:
         word = Word(text=text)
         with self.assertRaises(ValidationError):
             word.full_clean()
コード例 #2
0
ファイル: test_models.py プロジェクト: sarahquigley/smp_api
 def test_word_text_should_be_valid(self):
     # Test that Word model text without spaces or non-letter characters
     # (other than hyphen) is invalid
     # This test could possibly be made more thorough
     valid = ['a', 'a-b', ur'\u00C0']
     for text in valid:
         word = Word(text=text)
         try:
             word.full_clean()
         except ValidationError:
             self.fail("Word#save raised ValidationError unexpectedly.")