Beispiel #1
0
 def test_scinote_edge_case_at_10_to_7th_3(self):
     self.assertEqual(ti.scinote(10000000), '1.000e+07')
Beispiel #2
0
 def test_scinote_returns_fixed_pt_for_val_gt_ten_to_neg_four(self):
     self.assertEqual(ti.scinote(10**-3), '0.001000')
Beispiel #3
0
 def test_scinote_edge_case_at_10_to_7th_2(self):
     self.assertEqual(ti.scinote(9.999999999e+6, 3), '1.00e+07')
Beispiel #4
0
 def test_scinote_large_number_negative(self):
     self.assertEqual(ti.scinote(-56*10**1000, 4), '-5.600e+1001')
Beispiel #5
0
 def test_scinote_large_number_rounds_to_ten_re_written(self):
     self.assertEqual(ti.scinote(99999*10**1000, 4), '1.000e+1005')
Beispiel #6
0
 def test_scinote_edge_case_at_10_to_7th_negative_number_3(self):
     self.assertEqual(ti.scinote(-10000000), '-1.000e+07')
Beispiel #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')
Beispiel #8
0
 def test_scinote_as_above_with_negative_number(self):
     self.assertEqual(ti.scinote(-1.2345675e+6, 4), '-1,234,568')
Beispiel #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')
Beispiel #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')
Beispiel #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')
Beispiel #12
0
 def test_scinote_returns_commaed_int_at_less_than_ten_million(self):
     self.assertEqual(ti.scinote(2300001), '2,300,001')
Beispiel #13
0
 def test_scinote_returns_zero(self):
     self.assertEqual(ti.scinote(2*10**-500), '0.0')
Beispiel #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')
Beispiel #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')
Beispiel #16
0
 def test_scinote_rounds_commaed_float_and_retains_zeros(self):
     self.assertEqual(ti.scinote(123456.000, 8), '123,456.00')
Beispiel #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')
Beispiel #18
0
 def test_scinote_commaed_float_adds_missing_zeros(self):
     self.assertEqual(ti.scinote(123456., 8), '123,456.00')
Beispiel #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')
Beispiel #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')
Beispiel #21
0
 def test_scinote_large_number(self):
     self.assertEqual(ti.scinote(5*10**1000, 4), '5.000e+1000')
Beispiel #22
0
 def test_scinote_doesnt_add_digits_when_dig_len_larger_than_int(self):
     self.assertEqual(ti.scinote(1234, 6), '1,234')
Beispiel #23
0
 def test_scinote_large_number_rounds_like_it_should(self):
     self.assertEqual(ti.scinote(555551*10**1000, 4), '5.556e+1005')
Beispiel #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')
Beispiel #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')
Beispiel #26
0
 def test_scinote_returns_exp_for_val_le_ten_to_neg_four(self):
     self.assertEqual(ti.scinote(10**-4), '1.000e-04')