forked from CodeYouOrg/fashion-magazines-3e11c2-9fb9ec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b330d6e
commit 1729297
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import pandas as pd | ||
import pytest | ||
|
||
CSV_FILE = "data/fashion_magazines.csv" | ||
|
||
def test_file_exists(): | ||
assert os.path.exists(CSV_FILE) == True, "csv file does not exist" | ||
|
||
def test_columns_exist(): | ||
expected_columns = ['Customer','Amount Due'] | ||
try: | ||
df = pd.read_csv(CSV_FILE) | ||
for col in expected_columns: | ||
assert col in df.columns | ||
except Exception as e: | ||
assert False, e | ||
|
||
@pytest.mark.parametrize("expected_customer,expected_amount", | ||
[["Bethann Schraub",102], | ||
["Eryn Vilar",102], | ||
["Janay Priolo",57], | ||
["Lizabeth Letsche",237]]) | ||
def test_values_exist(expected_customer, expected_amount): | ||
try: | ||
df = pd.read_csv(CSV_FILE) | ||
assert df.loc[df['Customer'] == expected_customer]['Amount Due'].iloc[0] == expected_amount | ||
except Exception as e: | ||
assert False, e |