-
Notifications
You must be signed in to change notification settings - Fork 2
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
424546b
commit c4fe323
Showing
4 changed files
with
31 additions
and
4 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
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
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,5 @@ | ||
from pyspark.sql.types import StructType | ||
|
||
SCHEMA = ( | ||
StructType().add("the_string", "string").add("the_timestamp", "timestamp") | ||
) |
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,22 @@ | ||
|
||
import pytest | ||
from pyspark.sql import SparkSession | ||
|
||
from src.dq_suite.output_transformations import create_empty_dataframe | ||
|
||
from .test_data.test_schema import SCHEMA as AFWIJKING_SCHEMA | ||
|
||
|
||
@pytest.fixture() | ||
def spark(): | ||
return SparkSession.builder.master("local").appName("chispa").getOrCreate() | ||
|
||
|
||
@pytest.mark.usefixtures("spark") | ||
class TestCreateEmptyDataframe: | ||
def test_create_empty_dataframe_returns_empty_dataframe(self, spark): | ||
empty_dataframe = create_empty_dataframe( | ||
spark_session=spark, | ||
schema=AFWIJKING_SCHEMA, | ||
) | ||
assert len(empty_dataframe.head(1)) == 0 |