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