コード例 #1
0
ファイル: models.py プロジェクト: dan-brown/RiddleBase
 def clean(self):
     pat_len = len(self.pattern)
     sol_len = len(self.solution)
     if pat_len != sol_len:
         raise ValidationError('Pattern length does not match solution length.')
     if not util.is_square(pat_len):
         raise ValidationError('Riddle value length is not square.')
コード例 #2
0
ファイル: models.py プロジェクト: fossabot/riddlebase
 def clean(self):
     pat_len = len(self.pattern)
     sol_len = len(self.solution)
     if pat_len != sol_len:
         raise ValidationError(
             'Pattern length does not match solution length.')
     if not util.is_square(pat_len):
         raise ValidationError('Riddle value length is not square.')
コード例 #3
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_0_is_square(self):
     self.assertTrue(util.is_square(0))
コード例 #4
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_neg81_is_not_square(self):
     self.assertFalse(util.is_square(-81))
コード例 #5
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_neg500_is_not_square(self):
     self.assertFalse(util.is_square(-500))
コード例 #6
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_neg2_is_not_square(self):
     self.assertFalse(util.is_square(-2))
コード例 #7
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_neg0_is_square(self):
     self.assertTrue(util.is_square(-0))
コード例 #8
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_81_is_square(self):
     self.assertTrue(util.is_square(81))
コード例 #9
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_9_is_square(self):
     self.assertTrue(util.is_square(9))
コード例 #10
0
ファイル: test_util.py プロジェクト: fossabot/riddlebase
 def test_4_is_square(self):
     self.assertTrue(util.is_square(4))