Skip to content

Commit d1ef9f5

Browse files
committed
improve -Wrote the test for move_zeros algorithm.
1 parent bcac1c8 commit d1ef9f5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

move_zeros.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ def move_zeros(array: list) -> list:
2020
array.extend([0] * zero)
2121
return array
2222

23+
print(move_zeros([0, False, 1, 0, 1, 2, 0, 1, 3, 'python', 0]))
24+

tests/test_move_zeros.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from ..move_zeros import move_zeros
2+
3+
class TestMoveZeros:
4+
def test_move_zeros(self):
5+
assert move_zeros([0, False, 1, 0, 1, 2, 0, 1, 3, 'python', 0]) == [False, 1, 1, 2, 1, 3, 'python', 0, 0, 0, 0]
6+
assert move_zeros([True, 9, 0, 0, 0, -2, -4, 'Sri Lanka']) == [True, 9, -2, -4, 'Sri Lanka', 0, 0, 0]
7+
assert move_zeros([2, 1, 9, -4, 'GNU']) == [2, 1, 9, -4, 'GNU']
8+
assert move_zeros([0]) == [0]
9+
assert move_zeros([]) == []
10+

0 commit comments

Comments
 (0)