Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allow_nan_equality option to assert_approx_df_equality #29

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update README to reflect changes to assert_column_equality
mitches-got-glitches committed Apr 26, 2021
commit 3ff1f1816830ed6ac0b269e0d8d901732a5039bd
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -307,7 +307,7 @@ def test_approx_col_equality_same():
(None, None)
]
df = spark.createDataFrame(data, ["num1", "num2"])
assert_approx_column_equality(df, "num1", "num2", 0.1)
assert_column_equality(df, "num1", "num2", precision=0.1)
```

Here's an example of a test with columns that are not approximately equal.
@@ -321,7 +321,7 @@ def test_approx_col_equality_different():
(None, None)
]
df = spark.createDataFrame(data, ["num1", "num2"])
assert_approx_column_equality(df, "num1", "num2", 0.1)
assert_column_equality(df, "num1", "num2", precision=0.1)
```

This failing test will output a readable error message so the issue is easy to debug.
4 changes: 2 additions & 2 deletions tests/test_readme_examples.py
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ def test_approx_col_equality_same():
(None, None)
]
df = spark.createDataFrame(data, ["num1", "num2"])
assert_approx_column_equality(df, "num1", "num2", 0.1)
assert_column_equality(df, "num1", "num2", precision=0.1)


def test_approx_col_equality_different():
@@ -143,7 +143,7 @@ def test_approx_col_equality_different():
]
df = spark.createDataFrame(data, ["num1", "num2"])
with pytest.raises(ColumnsNotEqualError) as e_info:
assert_approx_column_equality(df, "num1", "num2", 0.1)
assert_column_equality(df, "num1", "num2", precision=0.1)


def test_approx_df_equality_same():