Skip to content

Commit

Permalink
Updated python unit tests.
Browse files Browse the repository at this point in the history
Refs #7805
  • Loading branch information
Samuel Jackson committed Sep 2, 2013
1 parent da37bb9 commit fcbb73e
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,32 @@ class BoundedValidatorTest(unittest.TestCase):
def test_construction_does_not_raise_error_when_both_are_floats(self):
testhelpers.assertRaisesNothing(self, FloatBoundedValidator, 1.0, 2.0)

def test_construction_with_inclusive_bounds_with_floats(self):
testhelpers.assertRaisesNothing(self, FloatBoundedValidator, 1.0, 2.0, True)

def test_constructor_sets_both_boundary_values_correctly(self):
validator = FloatBoundedValidator(1.3, 2.6)
self.assertTrue(validator.hasLower())
self.assertEquals(validator.lower(), 1.3)
self.assertTrue(validator.hasUpper())
self.assertEquals(validator.upper(), 2.6)
self.assertFalse(validator.isLowerInclusive())
self.assertFalse(validator.isUpperInclusive())

def test_constructor_sets_both_inclusive_boundary_values_correctly(self):
validator = FloatBoundedValidator(1.3, 2.6, True)
self.assertTrue(validator.hasLower())
self.assertEquals(validator.lower(), 1.3)
self.assertTrue(validator.hasUpper())
self.assertEquals(validator.upper(), 2.6)
self.assertTrue(validator.isLowerInclusive())
self.assertTrue(validator.isUpperInclusive())

def test_construction_does_not_raise_error_when_both_are_ints(self):
testhelpers.assertRaisesNothing(self, IntBoundedValidator, 1, 20)

def test_construction_with_inclusive_bounds_with_ints(self):
testhelpers.assertRaisesNothing(self, IntBoundedValidator, 1, 20, True)

def test_lower_only_keyword_in_constructor(self):
validator = FloatBoundedValidator(lower=2.5)
Expand Down

0 comments on commit fcbb73e

Please sign in to comment.