-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing checklist argument for validating resource (#1677)
Very important and simple fix to make sure the skip_errors, and overall checklist are passed down to resource.validate calls Fixes #1639 --------- Co-authored-by: Pierre Camilleri <[email protected]>
- Loading branch information
1 parent
e95321a
commit 84c3ea0
Showing
2 changed files
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import json | ||
|
||
from frictionless import Checklist, Package | ||
|
||
|
||
def test_package_validate_with_skip_errors(): | ||
## Test runs on data with two blank-row errors, one primary-key error, see | ||
# first test case | ||
test_cases = [ | ||
{"ignore": [], "expect_errors": ["blank-row", "primary-key", "blank-row"]}, | ||
{"ignore": ["primary-key"], "expect_errors": ["blank-row", "blank-row"]}, | ||
{"ignore": ["blank-row"], "expect_errors": ["primary-key"]}, | ||
{"ignore": ["blank-row", "primary-key"], "expect_errors": []}, | ||
] | ||
|
||
for tc in test_cases: | ||
with open("data/invalid/datapackage.json") as file: | ||
package = Package(json.load(file), basepath="data/invalid") | ||
checklist = Checklist(skip_errors=tc["ignore"]) | ||
|
||
report = package.validate(checklist) | ||
|
||
assert report.flatten(["type"]) == [[t] for t in tc["expect_errors"]] |
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