forked from nogibjj/atreya-tadepalli-miniproject10
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_main.py
32 lines (21 loc) · 1.04 KB
/
test_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Test goes here
"""
from pyspark.sql import SparkSession
from mylib.extract import extract_load
import os
from mylib.transform_load import transform_table
from mylib.query import query
spark = SparkSession.builder.master("local[*]").appName("test_app").getOrCreate()
def test_extract_load():
output_path = extract_load(url="https://raw.githubusercontent.com/MainakRepositor/Datasets/refs/heads/master/heart_failure_clinical_records_dataset.csv",
file_path="data/heart_failure.csv")
assert os.path.exists(output_path)
def test_transform():
df = transform_table("heart_failure_load","heart-failure-transform")
assert df is None, "Dataframe is None; load_data failed."
def test_query():
extract_load(url="https://raw.githubusercontent.com/MainakRepositor/Datasets/refs/heads/master/heart_failure_clinical_records_dataset.csv",
file_path="data/heart_failure.csv")
transform_table("heart-failure-load","heart-failure-transform")
assert query("SELECT AVG(age) FROM heart-failure-transform WHERE smoking=1") is None