File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,11 @@ DataPytheon/
4545├── tests/ # Basic unit tests for scripts
4646│ └── test_titanic.py
4747```
48+
49+ ## 🧪 Run your tests
50+
51+ Just run the next command from the root folder of the project:
52+
53+ ```
54+ pytest --cov=src
55+ ```
Original file line number Diff line number Diff line change @@ -14,18 +14,26 @@ def test_load_titanic_data_returns_dataframe():
1414 "survived" ,
1515 "pclass" ,
1616 "sex" ,
17- "age" ,
1817 "sibsp" ,
1918 "parch" ,
2019 "fare" ,
2120 "embarked" ,
21+ "class" ,
22+ "who" ,
23+ "adult_male" ,
24+ "alone"
2225 }
26+
2327 missing_cols = expected_cols - set (df .columns )
28+ print (f"Missing columns: { missing_cols } " )
2429 assert not missing_cols , f"Missing expected columns: { missing_cols } "
2530
26- # Check no critical nulls remain in 'age' or 'embarked'
27- assert df ["age" ].isnull ().sum () == 0 , "'age' column should have no nulls"
28- assert df ["embarked" ].isnull ().sum () == 0 , "'embarked' column should have no nulls"
31+ # Check that 'embarked' column has more than one categorical values
32+ assert df ["embarked" ].nunique () > 1 , "'embarked' column should have more than one unique value"
33+
34+ # Check that no null values exist in the DataFrame
35+ assert df .isnull ().sum ().sum () == 0 , "DataFrame should not contain any null values"
2936
3037 # Check that some rows exist
3138 assert len (df ) > 0 , "DataFrame should not be empty"
39+
You can’t perform that action at this time.
0 commit comments