Skip to content

Commit

Permalink
Remove logging test
Browse files Browse the repository at this point in the history
  • Loading branch information
smoia committed May 11, 2023
1 parent 350bbcf commit 003991c
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions phys2cvr/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,6 @@ def test_if_declared_force_type(var, dtype, out):
assert io.if_declared_force_type(var, dtype) == out


@patch("logging.warning")
@pytest.mark.parametrize(
"var, dtype, varname, expected_warning",
[
(
10,
"int",
"my_var",
"Changing type of variable my_var from <class 'int'> to int",
),
("10", "int", "my_var", ""),
(
[10],
"int",
"my_var",
"Changing type of variable my_var from <class 'list'> to int",
),
(None, "int", "my_var", ""),
(10.0, "float", "my_var", ""),
],
)
def test_if_declared_force_type_logging(mock_warning):
io.if_declared_force_type(10, "int", "my_var")
mock_warning.assert_called_with(
"Changing type of variable my_var from <class 'int'> to int"
)

io.if_declared_force_type("10", "int", "my_var")
mock_warning.assert_not_called()

io.if_declared_force_type([10], "int", "my_var")
mock_warning.assert_called_with(
"Changing type of variable my_var from <class 'list'> to int"
)

io.if_declared_force_type(None, "int", "my_var")
mock_warning.assert_not_called()

io.if_declared_force_type(10.0, "float", "my_var", silent=True)
mock_warning.assert_not_called()


def test_check_ext():
all_ext = [".csv", ".txt"]
fname = "data.csv"
Expand Down

0 comments on commit 003991c

Please sign in to comment.