def test_range_length_constructor_returns_hasMinMax(self): lower = 4 upper = 7 validator = FloatArrayLengthValidator(lower, upper) self.assertTrue(validator.hasMinLength()) self.assertTrue(validator.hasMaxLength()) self.assertEqual(validator.getMinLength(), lower) self.assertEqual(validator.getMaxLength(), upper)
def test_range_length_constructor_returns_hasMinMax(self): lower = 4 upper = 7 validator = FloatArrayLengthValidator(lower, upper) self.assertTrue(validator.hasMinLength()) self.assertTrue(validator.hasMaxLength()) self.assertEquals(validator.getMinLength(), lower) self.assertEquals(validator.getMaxLength(), upper)
def test_setMinMaxLength_alters_accepted_range(self): validator = FloatArrayLengthValidator() self.assertFalse(validator.hasMinLength()) self.assertFalse(validator.hasMaxLength()) lower = 4 upper = 7 validator.setLengthMin(lower) self.assertTrue(validator.hasMinLength()) self.assertFalse(validator.hasMaxLength()) self.assertEqual(validator.getMinLength(), lower) validator.setLengthMax(upper) self.assertTrue(validator.hasMinLength()) self.assertTrue(validator.hasMaxLength()) self.assertEqual(validator.getMaxLength(), upper) validator.clearLengthMin() self.assertFalse(validator.hasMinLength()) self.assertTrue(validator.hasMaxLength()) validator.clearLengthMax() self.assertFalse(validator.hasMinLength()) self.assertFalse(validator.hasMaxLength())
def test_setMinMaxLength_alters_accepted_range(self): validator = FloatArrayLengthValidator() self.assertFalse(validator.hasMinLength()) self.assertFalse(validator.hasMaxLength()) lower = 4 upper = 7 validator.setLengthMin(lower) self.assertTrue(validator.hasMinLength()) self.assertFalse(validator.hasMaxLength()) self.assertEquals(validator.getMinLength(), lower) validator.setLengthMax(upper) self.assertTrue(validator.hasMinLength()) self.assertTrue(validator.hasMaxLength()) self.assertEquals(validator.getMaxLength(), upper) validator.clearLengthMin() self.assertFalse(validator.hasMinLength()) self.assertTrue(validator.hasMaxLength()) validator.clearLengthMax() self.assertFalse(validator.hasMinLength()) self.assertFalse(validator.hasMaxLength())
def test_empty_constructor_has_no_lengths_set(self): validator = FloatArrayLengthValidator() self.assertFalse(validator.hasLength()) self.assertFalse(validator.hasMinLength()) self.assertFalse(validator.hasMaxLength())