def test_move_zeros_with_none(): assert move_zeros([ "a", 0, 0, "b", None, "c", "d", 0, 1, False, 0, 1, 0, 3, [], 0, 1, 9, 0, 0, {}, 0, 0, 9 ]) == [ "a", "b", None, "c", "d", 1, False, 1, 3, [], 1, 9, {}, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
def test_returns_zeros_at_end(self): """ Tests that all zeros in list have been moved to the end """ l = [4, 0, 9, 0, 1, 4, 0, False, None, 0, True, 0] result = move_zeros(l) self.assertEqual(result, [4, 9, 1, 4, False, None, True, 0, 0, 0, 0, 0])
def test_move_zeros_float(): assert move_zeros( [9, 0.0, 0, 9, 1, 2, 0, 1, 0, 1, 0.0, 3, 0, 1, 9, 0, 0, 0, 0, 9]) == [9, 9, 1, 2, 1, 1, 3, 1, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
def test_move_zeros_empty_list(): assert move_zeros([]) == []
def test_move_zeros_one_bool(): assert move_zeros([False]) == [False]
def test_move_zeros_one_zero(): assert move_zeros([0]) == [0]
def test_move_zeros_only_zeroes(): assert move_zeros([0, 0]) == [0, 0]
def test_move_zeros_one_letter(): assert move_zeros(["a"]) == ["a"]
def test_move_zeros_only_letters(): assert move_zeros(["a", "b"]) == ["a", "b"]
def test_move_zeros2(): assert move_zeros([0, 1, None, 2, False, 1, 0]) == [1, None, 2, False, 1, 0, 0]
def test_move_zeros(): assert move_zeros([1, 2, 0, 1, 0, 1, 0, 3, 0, 1]) == [1, 2, 1, 1, 3, 1, 0, 0, 0, 0]
def test_move_zeros_with_letters(): assert move_zeros([ "a", 0, 0, "b", "c", "d", 0, 1, 0, 1, 0, 3, 0, 1, 9, 0, 0, 0, 0, 9 ]) == ["a", "b", "c", "d", 1, 1, 3, 1, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
def test_return_none_for_wrong_argument(self): """ Tests that None is returned if the array argument is wrong """ result = move_zeros("test") self.assertEqual(result, None)
def test_return_none_for_no_argument(self): """ Tests that None is returned if no argument is passed in """ result = move_zeros() self.assertEqual(result, None)