示例#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))