Ejemplo n.º 1
0
 def test_fail(self):
     ''' Fail. '''
     with self.assertRaisesRegexp(AssertionError, '.*12.*'):
         util.assert_float_eq_int(13.01, 12)
     with self.assertRaisesRegexp(AssertionError, '.*12.*'):
         util.assert_float_eq_int(10.99, 12)
     with self.assertRaisesRegexp(AssertionError, '.*12.*'):
         util.assert_float_eq_int(12., -12)
Ejemplo n.º 2
0
 def test_success(self):
     ''' Success. '''
     # pylint: disable=no-self-use
     util.assert_float_eq_int(12., 12)
     util.assert_float_eq_int(12.3, 12)
     util.assert_float_eq_int(12.99, 12)
     util.assert_float_eq_int(11.01, 12)
     util.assert_float_eq_int(-11.8, -12)
     util.assert_float_eq_int(.01, 0)
     util.assert_float_eq_int(-.01, 0)