Skip to content

Commit

Permalink
fixes for failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shashigharti committed Jun 9, 2022
1 parent d23fe2a commit a578b83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions tests/report/test_report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from frictionless import validate
from frictionless import validate, helpers


IS_UNIX = not helpers.is_platform("windows")


def test_program_error_not_found():
Expand Down Expand Up @@ -30,11 +33,12 @@ def test_report_summary_validate_summary_valid():
report = validate("data/capital-valid.csv")
output = report.to_summary()
print(output)
file_size = 50 if IS_UNIX else 56
assert (
output.count("valid")
and output.count("Summary")
and output.count("File name | data/capital-valid.csv")
and output.count("File size (bytes) | 50 ")
and output.count(f"File size (bytes) | {file_size} ")
and output.count("Total Time Taken (sec) | ")
)

Expand All @@ -43,11 +47,12 @@ def test_report_summary_validate_summary_invalid():
report = validate("data/capital-invalid.csv")
output = report.to_summary()
print(output)
file_size = 171 if IS_UNIX else 183
assert (
output.count("invalid")
and output.count("Summary")
and output.count("File name | data/capital-invalid.csv")
and output.count("File size (bytes) | 171 ")
and output.count(f"File size (bytes) | {file_size} ")
and output.count("Total Time Taken (sec) |")
and output.count("Total Errors | 5 ")
and output.count("Duplicate Label (duplicate-label) | 1 ")
Expand Down
11 changes: 8 additions & 3 deletions tests/report/test_reporttask.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from frictionless import validate
from frictionless import validate, helpers


IS_UNIX = not helpers.is_platform("windows")


def test_report_reporttask_summary_valid():
report = validate("data/capital-valid.csv")
output = report.tasks[0].to_summary()
print(output)
file_size = 50 if IS_UNIX else 56
assert (
output.count("File name | data/capital-valid.csv")
and output.count("File size (bytes) | 50 ")
and output.count(f"File size (bytes) | {file_size} ")
and output.count("Total Time Taken (sec) | ")
)

Expand All @@ -16,9 +20,10 @@ def test_report_reporttask_summary_invalid():
report = validate("data/capital-invalid.csv")
output = report.tasks[0].to_summary()
print(output)
file_size = 171 if IS_UNIX else 183
assert (
output.count("File name | data/capital-invalid.csv")
and output.count("File size (bytes) | 171 ")
and output.count(f"File size (bytes) | {file_size} ")
and output.count("Total Time Taken (sec) |")
and output.count("Total Errors | 5 ")
and output.count("Duplicate Label (duplicate-label) | 1 ")
Expand Down

0 comments on commit a578b83

Please sign in to comment.