Beispiel #1
0
 def test_getter_valid(self):
     """
     Ensure that the Integer getter returns an integer without error
     given each of the known numeric literals
     """
     from crushinator.toolkit.probes import Integer
     
     probe = Integer('probe')
     
     for integer in valid_integers:
         probe.value = integer
         self.assertTrue(isinstance(probe.value, (int)), "%s is not an integer" % integer)
Beispiel #2
0
 def test_getter_invalid(self):
     """
     Ensure that the Integer getter throws a ValueError for any improper values
     """
     from crushinator.toolkit.probes import Integer
     import sys
     
     probe = Integer('probe')
     
     for integer in invalid_integers+valid_floats:
         probe.value = integer
         try:
             x = probe.value
         except ValueError:
             pass
         else:
             self.fail("%s did not raise ValueError, coverted to %s" % (integer, x))