Skip to content

Commit

Permalink
add river
Browse files Browse the repository at this point in the history
  • Loading branch information
khuyentran1401 committed Dec 5, 2022
1 parent e53ca8a commit 9d58236
Show file tree
Hide file tree
Showing 5 changed files with 1,266 additions and 11 deletions.
2 changes: 1 addition & 1 deletion data_science_tools/pandera_hypothesis/test1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def test_processing_fn():
# Create expected output
expected = df.copy()
expected["val3"] = [1, 0.5, 0.5, 2, 1]

# Test
assert_frame_equal(result, expected, check_dtype=False)
4 changes: 2 additions & 2 deletions data_science_tools/pandera_hypothesis/test3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd
import pandera as pa
import pytest
from pandas.testing import assert_frame_equal
import pandera as pa

expected = pa.DataFrameSchema(
{
Expand All @@ -28,4 +28,4 @@ def test_processing_fn(val1, val2):
df = pd.DataFrame({"val1": val1, "val2": val2})

# Get result
result = processing_fn(df)
processing_fn(df)
10 changes: 6 additions & 4 deletions data_science_tools/pandera_hypothesis/test4.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import hypothesis
import pandas as pd
import pytest
import pandera as pa
import hypothesis
import pytest

schema = pa.DataFrameSchema(
{
"val1": pa.Column(int, pa.Check.in_range(-2, 3)),
"val2": pa.Column(int, pa.Check.in_range(-2, 3)),
}
)
)

expected = pa.DataFrameSchema(
{
Expand All @@ -18,12 +18,14 @@
}
)


@pa.check_output(expected)
def processing_fn(df):
processed = df.assign(val3=df.val1 / df.val2)
return processed


@hypothesis.given(schema.strategy(size=5))
def test_processing_fn(df):
# Get result
result = processing_fn(df)
processing_fn(df)
Loading

0 comments on commit 9d58236

Please sign in to comment.