Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanna Imshenetska authored and Hanna Imshenetska committed Oct 24, 2024
1 parent dae6045 commit 372a722
Showing 1 changed file with 63 additions and 62 deletions.
125 changes: 63 additions & 62 deletions src/tests/unit/validation_metadata/test_validation_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def test_validate_metadata_of_one_table_without_fk_key_in_train_process(
):
"""
Test the validation of the metadata of one table contained only the primary key
used in the training process
during the training process
"""
rp_logger.info(
"Test the validation of the metadata of one table contained the primary key "
"used in the training process"
"during the training process"
)
test_metadata = {
"test_table": {
Expand Down Expand Up @@ -79,12 +79,12 @@ def test_validate_metadata_of_one_table_without_fk_key_in_train_process_without_
"""
Test the validation of the metadata of one table
contained only the primary key
used in the training process
during the training process
with 'validation_source' set to 'False'
"""
rp_logger.info(
"Test the validation of the metadata of one table "
"contained only the primary ke used in the training process "
"contained only the primary key during the training process "
"with 'validation_source' set to 'False'"
)
test_metadata = {
Expand Down Expand Up @@ -230,11 +230,11 @@ def test_validate_metadata_of_related_tables_with_fk_key_in_train_process(
"""
Test the validation of the metadata of related tables
contained the primary key and the foreign key
used in the training process
during the training process
"""
rp_logger.info(
"Test the validation of the metadata of related tables "
"contained only the primary key and the foreign key used in the training process"
"contained only the primary key and the foreign key during the training process"
)
test_metadata = {
"table_a": {
Expand Down Expand Up @@ -276,8 +276,8 @@ def test_validate_metadata_of_related_tables_with_fk_key_in_train_process(
validator.run()
assert validator.mapping == {
"fk_id": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == test_metadata
Expand Down Expand Up @@ -308,12 +308,12 @@ def test_validate_metadata_of_related_tables_with_fk_key_in_train_process_withou
"""
Test the validation of the metadata of related tables
contained the primary key and the foreign key
used in the training process with 'validation_source' set to 'False'
during the training process with 'validation_source' set to 'False'
"""
rp_logger.info(
"Test the validation of the metadata of related tables "
"contained the primary key and the foreign key "
"used in the training process with 'validation_source' set to 'False'"
"during the training process with 'validation_source' set to 'False'"
)
test_metadata = {
"table_a": {
Expand Down Expand Up @@ -350,8 +350,8 @@ def test_validate_metadata_of_related_tables_with_fk_key_in_train_process_withou
validator.run()
assert validator.mapping == {
"fk_id": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == test_metadata
Expand Down Expand Up @@ -382,11 +382,11 @@ def test_validate_metadata_of_related_tables_with_several_fk_key_in_train_proces
"""
Test the validation of the metadata of related tables
contained several foreign keys
used in the training process
during the training process
"""
rp_logger.info(
"Test the validation of the metadata of related tables contained several foreign keys "
"used in the training process"
"during the training process"
)
test_metadata = {
"table_a": {
Expand Down Expand Up @@ -436,12 +436,12 @@ def test_validate_metadata_of_related_tables_with_several_fk_key_in_train_proces
validator.run()
assert validator.mapping == {
"fk_1": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
},
"fk_2": {
"parent_columns": ["name"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["name"]
}
}
assert validator.merged_metadata == test_metadata
Expand Down Expand Up @@ -472,12 +472,12 @@ def test_validate_metadata_of_related_tables_with_several_fk_key_in_train_withou
"""
Test the validation of the metadata of related tables
contained several foreign keys
used in the training process
during the training process
with 'validation_source' set to 'False'
"""
rp_logger.info(
"Test the validation of the metadata of related tables contained several foreign keys "
"used in the training process with 'validation_source' set to 'False"
"during the training process with 'validation_source' set to 'False"
)
test_metadata = {
"table_a": {
Expand Down Expand Up @@ -522,12 +522,12 @@ def test_validate_metadata_of_related_tables_with_several_fk_key_in_train_withou
validator.run()
assert validator.mapping == {
"fk_1": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
},
"fk_2": {
"parent_columns": ["name"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["name"]
}
}
assert validator.merged_metadata == test_metadata
Expand Down Expand Up @@ -561,11 +561,11 @@ def test_validate_metadata_of_one_table_without_fk_key_in_infer_process(
):
"""
Test the validation of the metadata of one table
contained the primary key used in the inference process
contained the primary key during the inference process
"""
rp_logger.info(
"Test the validation of the metadata of one table contained the primary key "
"used in the inference process"
"during the inference process"
)
test_metadata = {
"test_table": {
Expand Down Expand Up @@ -619,11 +619,11 @@ def test_validate_metadata_of_related_tables_without_fk_key_in_infer_process(
"""
Test the validation of the metadata of related tables
contained only the primary key and the unique key
used in the inference process
during the inference process
"""
rp_logger.info(
"Test the validation of the metadata of related tables "
"contained only the primary key and the unique key used in the inference process"
"contained only the primary key and the unique key during the inference process"
)
test_metadata = {
"table_a": {
Expand Down Expand Up @@ -694,11 +694,11 @@ def test_validate_metadata_of_related_tables_with_fk_key_in_infer_process(
"""
Test the validation of the metadata of related tables
contained the primary key and the foreign key
used in the inference process
during the inference process
"""
rp_logger.info(
"Test the validation of the metadata of related tables "
"contained only the primary key and the foreign key used in the inference process"
"contained only the primary key and the foreign key during the inference process"
)
test_metadata = {
"table_a": {
Expand Down Expand Up @@ -743,8 +743,8 @@ def test_validate_metadata_of_related_tables_with_fk_key_in_infer_process(
validator.run()
assert validator.mapping == {
"fk_id": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == test_metadata
Expand Down Expand Up @@ -777,11 +777,11 @@ def test_validate_metadata_of_related_tables_with_several_fk_key_in_infer_proces
):
"""
Test the validation of the metadata of related tables
contained several foreign keys used in the inference process
contained several foreign keys during the inference process
"""
rp_logger.info(
"Test the validation of the metadata of related tables contained several foreign keys "
"used in the inference process"
"during the inference process"
)
test_metadata = {
"table_a": {
Expand Down Expand Up @@ -834,12 +834,12 @@ def test_validate_metadata_of_related_tables_with_several_fk_key_in_infer_proces
validator.run()
assert validator.mapping == {
"fk_1": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
},
"fk_2": {
"parent_columns": ["name"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["name"]
}
}
assert validator.merged_metadata == test_metadata
Expand Down Expand Up @@ -907,8 +907,8 @@ def test_validate_incomplete_metadata_contained_fk_key_in_train_process_without_
validator.run()
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == {
Expand Down Expand Up @@ -1125,8 +1125,8 @@ def test_validate_incomplete_metadata_contained_fk_key_in_train_process_with_gen
validator.run()
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == {
Expand Down Expand Up @@ -1231,8 +1231,8 @@ def test_validate_incomplete_metadata_in_infer_process(
validator.run()
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == {
Expand Down Expand Up @@ -1381,8 +1381,8 @@ def test_validate_incomplete_metadata_with_absent_parent_metadata_in_metadata_st
validator.run()
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
message = (
Expand Down Expand Up @@ -1450,8 +1450,8 @@ def test_validate_incomplete_metadata_with_wrong_referential_integrity(
validator.run()
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_d"
"parent_table": "table_d",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == {
Expand Down Expand Up @@ -1509,11 +1509,11 @@ def test_validate_metadata_with_not_existent_destination(
rp_logger
):
"""
Test the validation of the metadata of one table used in the inference process.
Test the validation of the metadata of one table during the inference process.
The destination for the generated data is not existent.
"""
rp_logger.info(
"Test the validation of the metadata of one table used in the inference process. "
"Test the validation of the metadata of one table during the inference process. "
"The destination of the table is not existent."
)
test_metadata = {
Expand Down Expand Up @@ -1575,14 +1575,14 @@ def test_validate_incomplete_metadata_with_absent_success_file_of_parent_table_i
):
"""
Test the validation of the incomplete metadata of one table contained the foreign key
used in the training process.
during the training process.
The information of the parent table is present in the metadata storage,
but the parent table hasn't been trained previously
that's why the success file of the parent table is absent
"""
rp_logger.info(
"Test the validation of the incomplete metadata of one table contained the foreign key "
"used in the training process. The information of the parent table is present "
"during the training process. The information of the parent table is present "
"in the metadata storage, but the parent table hasn't been trained previously "
"that's why the success file of the parent table is absent"
)
Expand Down Expand Up @@ -1620,8 +1620,8 @@ def test_validate_incomplete_metadata_with_absent_success_file_of_parent_table_i
mock_check_existence_of_generated_data.assert_not_called()
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == {
Expand Down Expand Up @@ -1683,13 +1683,13 @@ def test_validate_incomplete_metadata_with_absent_generated_of_parent_table_in_i
):
"""
Test the validation of the incomplete metadata of one table contained the foreign key
used in the inference process.
during the inference process.
The information of the parent table is present in the metadata storage,
but the generated data of the parent table hasn't been generated previously
"""
rp_logger.info(
"Test the validation of the incomplete metadata of one table contained the foreign key "
"used in the inference process. The information of the parent table is present "
"during the inference process. The information of the parent table is present "
"in the metadata storage, but the generated data of the parent table hasn't been "
"generated previously"
)
Expand Down Expand Up @@ -1721,8 +1721,8 @@ def test_validate_incomplete_metadata_with_absent_generated_of_parent_table_in_i
assert mock_check_existence_of_destination.call_count == 2
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == {
Expand Down Expand Up @@ -1805,14 +1805,15 @@ def test_validate_incomplete_metadata_without_gen_parent_table_in_train_process_
):
"""
Test the validation of the incomplete metadata of one table contained the foreign key
used in the training process with the generation of 'accuracy' or 'metrics_only' reports.
during the training process with the generation of reports that requires
the generation of the synthetic data.
The information of the parent table is present in the metadata storage,
but the generated data of the parent table hasn't been generated previously
"""
rp_logger.info(
"Test the validation of the incomplete metadata of one table "
"contained the foreign key used in the training process with "
"the generation of 'accuracy' or 'metrics_only' reports. "
"the generation of reports that requires the generation of the synthetic data. "
"The information of the parent table is present in the metadata storage, "
"but the generated data of the parent table hasn't been generated previously"
)
Expand Down Expand Up @@ -1844,8 +1845,8 @@ def test_validate_incomplete_metadata_without_gen_parent_table_in_train_process_
validator.run()
assert validator.mapping == {
"fk_key": {
"parent_columns": ["id"],
"parent_table": "table_a"
"parent_table": "table_a",
"parent_columns": ["id"]
}
}
assert validator.merged_metadata == {
Expand Down

0 comments on commit 372a722

Please sign in to comment.