Exemple #1
0
 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.')
Exemple #2
0
 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.')
Exemple #3
0
 def test_0_is_square(self):
     self.assertTrue(util.is_square(0))
Exemple #4
0
 def test_neg81_is_not_square(self):
     self.assertFalse(util.is_square(-81))
Exemple #5
0
 def test_neg500_is_not_square(self):
     self.assertFalse(util.is_square(-500))
Exemple #6
0
 def test_neg2_is_not_square(self):
     self.assertFalse(util.is_square(-2))
Exemple #7
0
 def test_neg0_is_square(self):
     self.assertTrue(util.is_square(-0))
Exemple #8
0
 def test_81_is_square(self):
     self.assertTrue(util.is_square(81))
Exemple #9
0
 def test_9_is_square(self):
     self.assertTrue(util.is_square(9))
Exemple #10
0
 def test_4_is_square(self):
     self.assertTrue(util.is_square(4))