def test_large_npfloat64(self): num = np.float64(1e6) self.assertEqual('1.00e+06', HP.format_number(num))
def test_large_neg_float_is_in_sci_not(self): formatted = HP.format_number(-1e6) self.assertTrue('e' in formatted.lower())
def test_large_float(self): self.assertEqual('1.00e+06', HP.format_number(1e6))
def test_small_pos_float(self): self.assertEqual('1.00', HP.format_number(1.0))
def test_small_neg_float(self): self.assertEqual('-1.00', HP.format_number(-1.0))
def test_small_long(self): for num in range(-10, 10): as_long = long(num) self.assertEqual(str(as_long), HP.format_number(as_long))
def test_small_npint32(self): num = np.int32(6) self.assertEqual(str(num), HP.format_number(num))
def test_small_int(self): for num in range(-10, 10): self.assertEqual(str(num), HP.format_number(num))
def test_inf(self): self.assertEqual('inf', HP.format_number(float('inf')))
def test_nan(self): self.assertEqual('nan', HP.format_number(float('nan')))