-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
14 changed files
with
86 additions
and
56 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
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
3 changes: 2 additions & 1 deletion
3
examples/organizations/newsltd/projects/chronicle/datasets/contract_data/__init__.py
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from birgitta.dataset.dataset import DataSet | ||
from .schema import schema # noqa 401 | ||
|
||
from .schema import schema | ||
|
||
dataset = DataSet("one_call_prepared", schema) |
3 changes: 2 additions & 1 deletion
3
examples/organizations/newsltd/projects/chronicle/datasets/contracts/__init__.py
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from birgitta.dataset.dataset import DataSet | ||
from .schema import schema # noqa 401 | ||
|
||
from .schema import schema | ||
|
||
dataset = DataSet("chronicle_contracts", schema) |
3 changes: 2 additions & 1 deletion
3
examples/organizations/newsltd/projects/tribune/datasets/contracts/__init__.py
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from birgitta.dataset.dataset import DataSet | ||
from .schema import schema # noqa 401 | ||
|
||
from .schema import schema | ||
|
||
dataset = DataSet("tribune_contracts", schema) |
3 changes: 2 additions & 1 deletion
3
examples/organizations/newsltd/projects/tribune/datasets/daily_contract_states/__init__.py
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from birgitta.dataset.dataset import DataSet | ||
from .schema import schema # noqa 401 | ||
|
||
from .schema import schema | ||
|
||
dataset = DataSet("daily_contract_states", schema) |
3 changes: 2 additions & 1 deletion
3
examples/organizations/newsltd/projects/tribune/datasets/date_dim/__init__.py
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from birgitta.dataset.dataset import DataSet | ||
from .schema import schema # noqa 401 | ||
|
||
from .schema import schema | ||
|
||
dataset = DataSet("date_dim", schema) |
3 changes: 2 additions & 1 deletion
3
examples/organizations/newsltd/projects/tribune/datasets/filtered_contracts/__init__.py
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from birgitta.dataset.dataset import DataSet | ||
from .schema import schema # noqa 401 | ||
|
||
from .schema import schema | ||
|
||
dataset = DataSet("filtered_contracts", schema) |
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
28 changes: 0 additions & 28 deletions
28
...ganizations/newspublisherltd/projects/tribune/tests/recipes/test_daily_contract_states.py
This file was deleted.
Oops, something went wrong.
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,52 @@ | ||
import pytest | ||
from birgitta import spark | ||
from birgitta.schema.spark import print_df_rows | ||
from pyspark.sql.types import IntegerType | ||
from pyspark.sql.types import StringType | ||
from pyspark.sql.types import StructField | ||
from pyspark.sql.types import StructType | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def spark_session(): | ||
return spark.local_session() # duration: about 3secs | ||
|
||
|
||
fixtures_schema = StructType([ | ||
StructField('letter', StringType()), | ||
StructField('number', IntegerType()) | ||
]) | ||
|
||
|
||
@pytest.fixture() | ||
def fixtures_data(): | ||
return [ | ||
['a', 1], | ||
['b', 2] | ||
] | ||
|
||
|
||
@pytest.fixture() | ||
def df_print(): | ||
return """[ | ||
{ | ||
'letter': 'a', | ||
'number': 1 | ||
}, | ||
{ | ||
'letter': 'b', | ||
'number': 2 | ||
} | ||
] | ||
""" | ||
|
||
|
||
@pytest.mark.filterwarnings("ignore:numpy.ufunc size changed") | ||
def test_print_df_rows(spark_session, | ||
fixtures_data, | ||
df_print, | ||
capsys): | ||
df = spark_session.createDataFrame(fixtures_data, fixtures_schema) | ||
print_df_rows(df) | ||
captured = capsys.readouterr() | ||
assert captured.out == df_print |