Ejemplo n.º 1
0
 def test_scinote_edge_case_at_10_to_7th_3(self):
     self.assertEqual(ti.scinote(10000000), '1.000e+07')
Ejemplo n.º 2
0
 def test_scinote_returns_fixed_pt_for_val_gt_ten_to_neg_four(self):
     self.assertEqual(ti.scinote(10**-3), '0.001000')
Ejemplo n.º 3
0
 def test_scinote_edge_case_at_10_to_7th_2(self):
     self.assertEqual(ti.scinote(9.999999999e+6, 3), '1.00e+07')
Ejemplo n.º 4
0
 def test_scinote_large_number_negative(self):
     self.assertEqual(ti.scinote(-56*10**1000, 4), '-5.600e+1001')
Ejemplo n.º 5
0
 def test_scinote_large_number_rounds_to_ten_re_written(self):
     self.assertEqual(ti.scinote(99999*10**1000, 4), '1.000e+1005')
Ejemplo n.º 6
0
 def test_scinote_edge_case_at_10_to_7th_negative_number_3(self):
     self.assertEqual(ti.scinote(-10000000), '-1.000e+07')
Ejemplo n.º 7
0
 def test_scinote_fills_zeros_to_dig_len_over_10_to_7th(self):
     self.assertEqual(ti.scinote(1.2e+7, 6), '1.20000e+07')
Ejemplo n.º 8
0
 def test_scinote_as_above_with_negative_number(self):
     self.assertEqual(ti.scinote(-1.2345675e+6, 4), '-1,234,568')
Ejemplo n.º 9
0
 def test_scinote_rounds_commaed_float_for_dig_len_larger_than_tens_place(self):
     self.assertEqual(ti.scinote(123456.789, 8), '123,456.79')
Ejemplo n.º 10
0
 def test_scinote_return_commaed_int_for_float_longer_than_dig_len(self):
     self.assertEqual(ti.scinote(1.234567e+6, 4), '1,234,567')
Ejemplo n.º 11
0
 def test_scinote_rounds_commaed_int_for_float_larger_than_dig_len(self):
     self.assertEqual(ti.scinote(1.2345675e+6, 4), '1,234,568')
Ejemplo n.º 12
0
 def test_scinote_returns_commaed_int_at_less_than_ten_million(self):
     self.assertEqual(ti.scinote(2300001), '2,300,001')
Ejemplo n.º 13
0
 def test_scinote_returns_zero(self):
     self.assertEqual(ti.scinote(2*10**-500), '0.0')
Ejemplo n.º 14
0
 def test_scinote_edge_case_at_ten_to_neg_four(self):
     self.assertEqual(ti.scinote(9.99952*10**-4), '0.001000')
     self.assertEqual(ti.scinote(9.99949*10**-4), '9.999e-04')
Ejemplo n.º 15
0
 def test_scinote_edge_case_at_10_to_7th_negative_number_1(self):
     self.assertEqual(ti.scinote(-9.999999999e+6, 10), '-9,999,999.999')
Ejemplo n.º 16
0
 def test_scinote_rounds_commaed_float_and_retains_zeros(self):
     self.assertEqual(ti.scinote(123456.000, 8), '123,456.00')
Ejemplo n.º 17
0
 def test_scinote_edge_case_at_10_to_7th_negative_number_2(self):
     self.assertEqual(ti.scinote(-9.999999999e+6, 3), '-1.00e+07')
Ejemplo n.º 18
0
 def test_scinote_commaed_float_adds_missing_zeros(self):
     self.assertEqual(ti.scinote(123456., 8), '123,456.00')
Ejemplo n.º 19
0
 def test_scinote_returns_exponent_form_for_number_over_10_to_7th(self):
     self.assertEqual(ti.scinote(1.2345678e+7, 6), '1.23457e+07')
Ejemplo n.º 20
0
 def test_scinote_edge_case_non_exp_float_rounds_up_and_adds_a_digit(self):
     self.assertEqual(ti.scinote(99.999), '100.0')
Ejemplo n.º 21
0
 def test_scinote_large_number(self):
     self.assertEqual(ti.scinote(5*10**1000, 4), '5.000e+1000')
Ejemplo n.º 22
0
 def test_scinote_doesnt_add_digits_when_dig_len_larger_than_int(self):
     self.assertEqual(ti.scinote(1234, 6), '1,234')
Ejemplo n.º 23
0
 def test_scinote_large_number_rounds_like_it_should(self):
     self.assertEqual(ti.scinote(555551*10**1000, 4), '5.556e+1005')
Ejemplo n.º 24
0
 def test_scinote_edge_case_at_10_to_7th_1(self):
     self.assertEqual(ti.scinote(9.999999999e+6, 10), '9,999,999.999')
Ejemplo n.º 25
0
 def test_scinote_annoying_edge_case_due_to_python_rounding_errors(self):
     #the issue is python rounds the binary approximation of the float
     #so it's not rounding 5.5550000000000 it's rounding a slightly
     #smaller binary number.
     self.assertEqual(ti.scinote(5555*10**1000, 3), '5.55e+1003')
     self.assertEqual(ti.scinote(-5555*10**1000, 3), '-5.55e+1003')
Ejemplo n.º 26
0
 def test_scinote_returns_exp_for_val_le_ten_to_neg_four(self):
     self.assertEqual(ti.scinote(10**-4), '1.000e-04')