Skip to content

Commit 71c601a

Browse files
alexfurmenkovSFJohnson24gerrycampion
authored
changes in validation script to change engine location (#22)
* standards * rules * remove sheet .xpt * rules and test data sorted * env * remove xlsx results * script * use_case, usdm, results.csv * results processed * usdm trim * usdm, multiple sub folders * last tables * update * moved stray adam file * update datasets and variables csv and docs * remove .xpt extension * allow to override engine location in validation script * modified five rules to test by workflow * validation script change to support creating two reports * rollback metadata files names * fixed cycle in validation script. rolled back test data * replace committed/generated with expected/actual * got->actual * better details when results.csv is missing * change csv conversion to an engine output format * python instead of python3 --------- Co-authored-by: Samuel Johnson <sfjohnson24@gmail.com> Co-authored-by: Samuel Johnson <96841389+SFJohnson24@users.noreply.github.com> Co-authored-by: gerrycampion <85252124+gerrycampion@users.noreply.github.com> Co-authored-by: Gerry Campion <gcampion@cdisc.org>
1 parent d6648b1 commit 71c601a

6 files changed

Lines changed: 256 additions & 313 deletions

File tree

.github/scripts/convert_results.py

Lines changed: 0 additions & 93 deletions
This file was deleted.

.github/scripts/diff_results.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
"""
2-
diff_results.py — compares a committed results.csv against a freshly generated one.
2+
diff_results.py — compares an actual results.csv against an expected one.
33
44
Usage:
5-
python .github/scripts/diff_results.py <committed.csv> <generated.csv> <case_label>
5+
python .github/scripts/diff_results.py <expected.csv> <actual.csv> <case_label>
66
77
Exit codes:
88
0 — results match
99
1 — results differ (failure)
1010
2 — error
1111
"""
12+
1213
import csv
1314
import sys
1415
from itertools import zip_longest
@@ -22,40 +23,42 @@ def load(path: str) -> list[tuple]:
2223
return sorted(rows)
2324

2425

25-
def diff(committed_path: str, generated_path: str) -> list[str]:
26+
def diff(expected_path: str, actual_path: str) -> list[str]:
2627
diffs = []
27-
c_rows = load(committed_path)
28-
g_rows = load(generated_path)
28+
c_rows = load(expected_path)
29+
g_rows = load(actual_path)
2930

3031
if len(c_rows) != len(g_rows):
3132
diffs.append(
32-
f"Row count changed: {len(c_rows)} committed -> {len(g_rows)} generated"
33+
f"Row count changed: {len(c_rows)} expected -> {len(g_rows)} actual"
3334
)
3435

3536
_ABSENT = object()
36-
for i, (c_row, g_row) in enumerate(zip_longest(c_rows, g_rows, fillvalue=_ABSENT), start=1):
37+
for i, (c_row, g_row) in enumerate(
38+
zip_longest(c_rows, g_rows, fillvalue=_ABSENT), start=1
39+
):
3740
if c_row is _ABSENT:
38-
diffs.append(f" Row {i}: present in generated only -> {g_row}")
41+
diffs.append(f" Row {i}: present in actual only -> {g_row}")
3942
elif g_row is _ABSENT:
40-
diffs.append(f" Row {i}: present in committed only -> {c_row}")
43+
diffs.append(f" Row {i}: present in expected only -> {c_row}")
4144
elif c_row != g_row:
42-
diffs.append(f" Row {i}: committed={c_row} -> generated={g_row}")
45+
diffs.append(f" Row {i}: expected={c_row} -> actual={g_row}")
4346

4447
return diffs
4548

4649

4750
def main():
4851
if len(sys.argv) != 4:
4952
print(
50-
f"Usage: {sys.argv[0]} <committed.csv> <generated.csv> <case_label>",
53+
f"Usage: {sys.argv[0]} <expected.csv> <actual.csv> <case_label>",
5154
file=sys.stderr,
5255
)
5356
sys.exit(2)
5457

55-
committed_path, generated_path, case_label = sys.argv[1], sys.argv[2], sys.argv[3]
58+
expected_path, actual_path, case_label = sys.argv[1], sys.argv[2], sys.argv[3]
5659

5760
try:
58-
diffs = diff(committed_path, generated_path)
61+
diffs = diff(expected_path, actual_path)
5962
except Exception as e:
6063
print(f"ERROR comparing results for {case_label}: {e}", file=sys.stderr)
6164
sys.exit(2)

0 commit comments

Comments
 (0)