Skip to content

Commit 80b297e

Browse files
committed
Code climate: helpers/math: add basic unit test
1 parent b88f814 commit 80b297e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

strictdoc/helpers/math.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ def round_up(number: float, decimals):
66
assert isinstance(number, float)
77
assert isinstance(decimals, int)
88
assert decimals >= 0
9-
if decimals == 0:
10-
return ceil(number)
119

1210
factor = 10**decimals
1311

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from strictdoc.helpers.math import round_up
2+
3+
4+
def test_round_up():
5+
assert round_up(1.3333, 0) == 2
6+
assert round_up(1.3333, 1) == 1.4
7+
assert round_up(1.3333, 2) == 1.34
8+
assert round_up(1.3333, 3) == 1.334
9+
assert round_up(1.3333, 4) == 1.3333
10+
assert round_up(1.3333, 5) == 1.3333

0 commit comments

Comments
 (0)