Skip to content

Commit 59ce8e1

Browse files
committed
First
1 parent f10d033 commit 59ce8e1

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from codonPython.check_null import check_null
2+
import numpy as np
3+
import pandas as pd
4+
import pytest
5+
6+
testdata = pd.DataFrame({
7+
"col1" : [1,2,3,4,5,6,7,8,9,10],
8+
"col2" : [11,12,13,14,15,np.nan,np.nan,18,19,20],
9+
})
10+
11+
@pytest.mark.parametrize("dataframe, columns_to_be_checked, expected", [
12+
(testdata.iloc[:5, :], ["col1", "col2"], 0),
13+
(testdata, ["col2"], 2),
14+
])
15+
def test_BAU(dataframe, columns_to_be_checked, expected):
16+
assert check_null(dataframe, columns_to_be_checked) == expected
17+
18+
19+
@pytest.mark.parametrize("dataframe, columns_to_be_checked", [
20+
(testdata, 0.01),
21+
])
22+
def test_ValueError(dataframe, columns_to_be_checked):
23+
with pytest.raises(ValueError):
24+
check_null(dataframe, columns_to_be_checked)
25+
26+
27+
@pytest.mark.parametrize("dataframe, columns_to_be_checked", [
28+
(testdata, ["wrong_column"]),
29+
])
30+
def test_KeyError(dataframe, columns_to_be_checked):
31+
with pytest.raises(KeyError):
32+
check_null(dataframe, columns_to_be_checked)

0 commit comments

Comments
 (0)