Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions tests/QARegressionTests/globals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
issue_datails_sheet = "Issue Details"
dataset_details_sheet = "Dataset Details"
entity_details_sheet = "Entity Details"
rules_report_sheet = "Rules Report"
issue_sheet_coreid_column = "A"
dataset_sheet_dataset_column = "A"
Expand Down
14 changes: 7 additions & 7 deletions tests/QARegressionTests/test_Issues/test_CoreIssue1326.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from conftest import get_python_executable
from QARegressionTests.globals import (
dataset_details_sheet,
entity_details_sheet,
issue_datails_sheet,
rules_report_sheet,
issue_sheet_record_column,
Expand Down Expand Up @@ -81,7 +81,7 @@ def test_positive_dataset(self):
if os.path.exists(excel_file_path):
os.remove(excel_file_path)

def test_negaive_dataset(self):
def test_negative_dataset(self):
# Run the command in the terminal
command = [
f"{get_python_executable()}",
Expand Down Expand Up @@ -115,12 +115,12 @@ def test_negaive_dataset(self):
# # Open the Excel file
workbook = openpyxl.load_workbook(excel_file_path)

# --- Dataset Details ---
dataset_sheet = workbook[dataset_details_sheet]
# --- Entity Details ---
dataset_sheet = workbook[entity_details_sheet]
dataset_values = [row for row in dataset_sheet.iter_rows(values_only=True)][1:]
dataset_values = [row for row in dataset_values if any(row)]
assert len(dataset_values) > 0
assert dataset_values[0][0] == "StudyVersion.xpt"
assert dataset_values[0][0] == "StudyVersion"
assert dataset_values[0][-1] == 7

# --- Issue Summary ---
Expand All @@ -131,7 +131,7 @@ def test_negaive_dataset(self):
summary_values = [row for row in summary_values if any(row)]
assert len(summary_values) > 0
assert summary_values[0][1] == "CORE-000409"
assert summary_values[0][3] == 7
assert summary_values[0][4] == 7

# --- Issue Details ---
expected_values = [
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_negaive_dataset(self):
rules_values = [row for row in rules_values if any(row)]
assert len(rules_values) > 0
assert rules_values[0][0] == "CORE-000409"
assert rules_values[0][-1] == "SUCCESS"
assert rules_values[0][-1] == "ISSUE REPORTED"

if os.path.exists(excel_file_path):
os.remove(excel_file_path)
Expand Down
2 changes: 1 addition & 1 deletion tests/QARegressionTests/test_Issues/test_CoreIssue1332.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_ap_domain_should_be_correctly_substituted():
rules_values = [row for row in rules_values if any(row)]
assert len(rules_values) == 1
assert rules_values[0][0] == "CORE-000181"
assert "SUCCESS" in rules_values[0]
assert "ISSUE REPORTED" in rules_values[0]

if os.path.exists(excel_file_path):
os.remove(excel_file_path)
47 changes: 24 additions & 23 deletions tests/QARegressionTests/test_Issues/test_CoreIssue1421.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,29 @@ def test_validate_define_xml_against_lib_metadata():
# Go to the "Issue Details" sheet
sheet = workbook[issue_datails_sheet]

variables_values_column = sheet[issue_sheet_variable_column]
variables_values = [
cell.value for cell in variables_values_column[1:] if cell.value is not None
]
assert len(variables_values) == 1
for value in variables_values:
assert len(value.split(",")) == 6

# Check Variable(s) column (H)
variables_names_column = sheet["H"]
variables_names_values = [
cell.value for cell in variables_names_column[1:] if cell.value is not None
]
assert len(variables_names_values) == 1
assert len(variables_names_values) == 3
for value in variables_names_values:
assert len(value.split(",")) == 6

# Check Value(s) column (I)
variables_values_column = sheet[issue_sheet_variable_column]
variables_values = [
cell.value for cell in variables_values_column[1:] if cell.value is not None
]
assert len(variables_values) == 3
for value in variables_values:
assert len(value.split(",")) == 6

dataset_column = sheet["D"]
dataset_column_values = [
cell.value for cell in dataset_column[1:] if cell.value is not None
]
assert sorted(set(dataset_column_values)) == ["dm.xpt"]
assert sorted(set(dataset_column_values)) == ["dm.xpt", "suppec.xpt"]

core_id_column = sheet[issue_sheet_coreid_column]
core_id_column_values = [
Expand All @@ -85,7 +87,7 @@ def test_validate_define_xml_against_lib_metadata():
][1:]
rules_values = [row for row in rules_values if any(row)]
assert rules_values[0][0] == "CDISC.SDTMIG.CG0999"
assert "SUCCESS" in rules_values[0]
assert "ISSUE REPORTED" in rules_values[0]
assert (
rules_values[0][4]
== "Issue with codelist definition in the Define-XML document."
Expand All @@ -97,13 +99,13 @@ def test_validate_define_xml_against_lib_metadata():
dataset_values = [row for row in dataset_values if any(row)]
assert len(dataset_values) > 0
dataset_names = set(row[0] for row in dataset_values if row[0] is not None)
assert dataset_names == {"ae.xpt", "dm.xpt", "ec.xpt", "ex.xpt", "suppec.xpt"}
assert dataset_names == {"AE", "DM", "EC", "EX", "SUPPEC"}
expected_records = {
"ae.xpt": 74,
"dm.xpt": 18,
"ec.xpt": 1590,
"ex.xpt": 1583,
"suppec.xpt": 13,
"AE": 74,
"DM": 18,
"EC": 1590,
"EX": 1583,
"SUPPEC": 13,
}
for row in dataset_values:
dataset_name = row[0]
Expand All @@ -116,15 +118,14 @@ def test_validate_define_xml_against_lib_metadata():
1:
]
summary_values = [row for row in summary_values if any(row)]
assert len(summary_values) == 1
assert len(summary_values) == 2
core_ids = set(row[1] for row in summary_values if row[1] is not None)
assert core_ids == {"CDISC.SDTMIG.CG0999"}
# Check Message and dataset columns
assert (
summary_values[0][2]
== "Issue with codelist definition in the Define-XML document."
)
assert summary_values[0][0] == "dm.xpt"
for row in summary_values:
assert row[2] == "Issue with codelist definition in the Define-XML document."
datasets_in_summary = set(row[0] for row in summary_values if row[0] is not None)
assert datasets_in_summary == {"dm.xpt", "suppec.xpt"}

# Delete the excel file
if os.path.exists(excel_file_path):
Expand Down
8 changes: 4 additions & 4 deletions tests/QARegressionTests/test_Issues/test_CoreIssue164.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@pytest.mark.regression
def test_negative_dataset():
command = (
f"{get_python_executable()} -m core test -s sdtmig -v 3.4 -r "
f"{get_python_executable()} -m core validate -s sdtmig -v 3.4 -r "
+ os.path.join("tests", "resources", "CoreIssue164", "rule.json")
+ " -dp "
+ os.path.join("tests", "resources", "CoreIssue164", "Negative_Dataset.json")
Expand All @@ -27,7 +27,7 @@ def test_negative_dataset():
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()

file_name = stdout.decode().strip().split(": ")[1] + ".xlsx"
file_name = stdout.decode().strip().split(": ")[1]
# Open the Excel file
workbook = openpyxl.load_workbook(file_name)

Expand Down Expand Up @@ -76,7 +76,7 @@ def test_negative_dataset():
@pytest.mark.regression
def test_positive_dataset():
command = (
f"{get_python_executable()} -m core test -s sdtmig -v 3.4 -r "
f"{get_python_executable()} -m core validate -s sdtmig -v 3.4 -r "
+ os.path.join("tests", "resources", "CoreIssue164", "rule.json")
+ " -dp "
+ os.path.join("tests", "resources", "CoreIssue164", "Positive_Dataset.json")
Expand All @@ -89,7 +89,7 @@ def test_positive_dataset():
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()

file_name = stdout.decode().strip().split(": ")[1] + ".xlsx"
file_name = stdout.decode().strip().split(": ")[1]
print(file_name)
# Open the Excel file
workbook = openpyxl.load_workbook(file_name)
Expand Down
14 changes: 7 additions & 7 deletions tests/QARegressionTests/test_Issues/test_CoreIssue576.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@pytest.mark.regression
def test_negative_dataset():
command = (
f"{get_python_executable()} -m core test -s sdtmig -v 3.4 -r "
f"{get_python_executable()} -m core validate -s sdtmig -v 3.4 -r "
+ os.path.join("tests", "resources", "CoreIssue576", "Rule_underscores.json")
+ " -dp "
+ os.path.join("tests", "resources", "CoreIssue576", "Datasets_Negative.json")
Expand All @@ -37,7 +37,7 @@ def test_negative_dataset():
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()

file_name = stdout.decode().strip().split(": ")[1] + ".xlsx"
file_name = stdout.decode().strip().split(": ")[1]
# Open the Excel file
workbook = openpyxl.load_workbook(file_name)

Expand All @@ -62,7 +62,7 @@ def test_negative_dataset():
]

# Perform the assertion
assert dataset_values[0] == "dm.xpt"
assert dataset_values[0] == "DM"
assert len(dataset_values) == 1

assert len(coreid_values) == 0
Expand All @@ -79,7 +79,7 @@ def test_negative_dataset():
@pytest.mark.regression
def test_positive_dataset():
command = (
f"{get_python_executable()} -m core test -s sdtmig -v 3.4 -r "
f"{get_python_executable()} -m core validate -s sdtmig -v 3.4 -r "
+ os.path.join("tests", "resources", "CoreIssue576", "Rule_underscores.json")
+ " -dp "
+ os.path.join("tests", "resources", "CoreIssue576", "Datasets_positive.json")
Expand All @@ -92,7 +92,7 @@ def test_positive_dataset():
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()

file_name = stdout.decode().strip().split(": ")[1] + ".xlsx"
file_name = stdout.decode().strip().split(": ")[1]
# Open the Excel file
workbook = openpyxl.load_workbook(file_name)

Expand All @@ -117,8 +117,8 @@ def test_positive_dataset():
]

# Perform the assertion
assert dataset_values[0] == "suppae.xpt"
assert dataset_values[1] == "suppec.xpt"
assert dataset_values[0] == "SUPPAE"
assert dataset_values[1] == "SUPPEC"

assert len(coreid_values) == 0

Expand Down
4 changes: 2 additions & 2 deletions tests/QARegressionTests/test_Issues/test_CoreIssue715.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_negative_dataset(self):
]
summary_values = [r for r in summary_values if any(r)]
assert summary_values and summary_values[0][1] == "DDF00081"
assert summary_values[0][3] == 1
assert summary_values[0][4] == 1

# Issue Details strict checks: now expect one row per error
issue_details_sheet = workbook[issue_datails_sheet]
Expand All @@ -134,6 +134,6 @@ def test_negative_dataset(self):
][1:]
rules_rows = [r for r in rules_rows if any(r)]
assert rules_rows and rules_rows[0][0] == "DDF00081"
assert "SUCCESS" in rules_rows[0]
assert "ISSUE REPORTED" in rules_rows[0]
if os.path.exists(excel_file_path):
os.remove(excel_file_path)
2 changes: 1 addition & 1 deletion tests/QARegressionTests/test_Issues/test_CoreIssue720.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_negative_dataset(self):
summary_rows = [r for r in summary_rows if any(r)]
assert summary_rows[0][0] == "dm.xpt"
assert summary_rows[0][1] == "CDISC.SENDIG.105"
assert summary_rows[0][3] == 1
assert summary_rows[0][4] == 1

# Issue Details
details_rows = [
Expand Down
10 changes: 5 additions & 5 deletions tests/QARegressionTests/test_Issues/test_CoreIssue747.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@pytest.mark.regression
def test_CG0019():
command = (
f"{get_python_executable()} -m core test -s sdtmig -v 3.4 -r "
f"{get_python_executable()} -m core validate -s sdtmig -v 3.4 -r "
+ os.path.join("tests", "resources", "CoreIssue747", "Rule_underscores.json")
+ " -dp "
+ os.path.join("tests", "resources", "CoreIssue747", "Datasets.json")
Expand All @@ -38,7 +38,7 @@ def test_CG0019():
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()

file_name = stdout.decode().strip().split(": ")[1] + ".xlsx"
file_name = stdout.decode().strip().split(": ")[1]
# Open the Excel file
workbook = openpyxl.load_workbook(file_name)

Expand All @@ -64,9 +64,9 @@ def test_CG0019():

# Perform the assertion
assert process.returncode == 0, f"Process failed with error: {stderr.decode()}"
assert dataset_values[0] == "ecaa.xpt"
assert dataset_values[1] == "ecbb.xpt"
assert dataset_values[2] == "suppec.xpt"
assert dataset_values[0] == "ECAA"
assert dataset_values[1] == "ECBB"
assert dataset_values[2] == "SUPPEC"
assert len(dataset_values) == 3

assert len(coreid_values) == 4
Expand Down
11 changes: 6 additions & 5 deletions tests/QARegressionTests/test_Issues/test_CoreIssue897.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest
from conftest import get_python_executable
from QARegressionTests.globals import (
entity_details_sheet,
issue_datails_sheet,
rules_report_sheet,
issue_sheet_record_column,
Expand Down Expand Up @@ -80,7 +81,7 @@ def test_positive_dataset(self):
if os.path.exists(excel_file_path):
os.remove(excel_file_path)

def test_negaive_dataset(self):
def test_negative_dataset(self):
# Run the command in the terminal
command = [
f"{get_python_executable()}",
Expand Down Expand Up @@ -115,11 +116,11 @@ def test_negaive_dataset(self):
workbook = openpyxl.load_workbook(excel_file_path)

# --- Dataset Details ---
dataset_sheet = workbook["Dataset Details"]
dataset_sheet = workbook[entity_details_sheet]
dataset_values = [row for row in dataset_sheet.iter_rows(values_only=True)][1:]
dataset_values = [row for row in dataset_values if any(row)]
assert len(dataset_values) > 0
assert dataset_values[0][0] == "NarrativeContentItem.xpt"
assert dataset_values[0][0] == "NarrativeContentItem"
assert dataset_values[0][-1] == 170

# --- Issue Summary ---
Expand All @@ -130,7 +131,7 @@ def test_negaive_dataset(self):
summary_values = [row for row in summary_values if any(row)]
assert len(summary_values) > 0
assert summary_values[0][1] == "CORE-000409"
assert summary_values[0][3] == 4
assert summary_values[0][4] == 4

# --- Issue Details ---
issue_details_sheet = workbook["Issue Details"]
Expand All @@ -148,7 +149,7 @@ def test_negaive_dataset(self):
rules_values = [row for row in rules_values if any(row)]
assert len(rules_values) > 0
assert rules_values[0][0] == "CORE-000409"
assert rules_values[0][-1] == "SUCCESS"
assert rules_values[0][-1] == "ISSUE REPORTED"

if os.path.exists(excel_file_path):
os.remove(excel_file_path)
Expand Down
Loading