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