Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4ccdf94

Browse files
committed
Add test cases from original issue and discussion thread
1 parent fc4d3b5 commit 4ccdf94

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/test/test_fractions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,18 @@ def test_format_f_presentation_type(self):
10751075
(F(22, 7), '7.2%', '314.29%'),
10761076
(F(22, 7), '8.2%', ' 314.29%'),
10771077
(F(22, 7), '08.2%', '0314.29%'),
1078+
# Test cases from #67790 and discuss.python.org Ideas thread.
1079+
(F(1, 3), '.2f', '0.33'),
1080+
(F(1, 8), '.2f', '0.12'),
1081+
(F(3, 8), '.2f', '0.38'),
1082+
(F(2545, 1000), '.2f', '2.54'),
1083+
(F(2549, 1000), '.2f', '2.55'),
1084+
(F(2635, 1000), '.2f', '2.64'),
1085+
(F(1, 100), '.1f', '0.0'),
1086+
(F(49, 1000), '.1f', '0.0'),
1087+
(F(51, 1000), '.1f', '0.1'),
1088+
(F(149, 1000), '.1f', '0.1'),
1089+
(F(151, 1000), '.1f', '0.2'),
10781090
]
10791091
for fraction, spec, expected in testcases:
10801092
with self.subTest(fraction=fraction, spec=spec):

0 commit comments

Comments
 (0)