| 
									
										
										
										
											2025-04-03 10:39:47 +05:30
										 |  |  | #  Copyright 2025 Collate | 
					
						
							|  |  |  | #  Licensed under the Collate Community License, Version 1.0 (the "License"); | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | #  you may not use this file except in compliance with the License. | 
					
						
							|  |  |  | #  You may obtain a copy of the License at | 
					
						
							| 
									
										
										
										
											2025-04-03 10:39:47 +05:30
										 |  |  | #  https://github.com/open-metadata/OpenMetadata/blob/main/ingestion/LICENSE | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | #  Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  | #  distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  | #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  | #  See the License for the specific language governing permissions and | 
					
						
							|  |  |  | #  limitations under the License. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | shared test cases | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import os | 
					
						
							|  |  |  | from datetime import datetime, timedelta | 
					
						
							| 
									
										
										
										
											2024-11-27 08:50:54 +01:00
										 |  |  | from unittest.mock import patch | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | from uuid import uuid4 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import pytest | 
					
						
							|  |  |  | import sqlalchemy as sqa | 
					
						
							|  |  |  | from sqlalchemy.orm import declarative_base | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-27 16:25:12 +01:00
										 |  |  | from metadata.data_quality.builders.validator_builder import ValidatorBuilder | 
					
						
							| 
									
										
										
										
											2023-04-04 17:16:44 +02:00
										 |  |  | from metadata.data_quality.interface.sqlalchemy.sqa_test_suite_interface import ( | 
					
						
							|  |  |  |     SQATestSuiteInterface, | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | from metadata.generated.schema.entity.data.table import Column, DataType, Table | 
					
						
							|  |  |  | from metadata.generated.schema.entity.services.connections.database.sqliteConnection import ( | 
					
						
							|  |  |  |     SQLiteConnection, | 
					
						
							|  |  |  |     SQLiteScheme, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | from metadata.generated.schema.tests.testCase import TestCase, TestCaseParameterValue | 
					
						
							|  |  |  | from metadata.generated.schema.type.entityReference import EntityReference | 
					
						
							| 
									
										
										
										
											2024-11-19 08:10:45 +01:00
										 |  |  | from metadata.sampler.sqlalchemy.sampler import SQASampler | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Base = declarative_base() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_CASE_NAME = "my_test_case" | 
					
						
							|  |  |  | ENTITY_LINK_NICKNAME = "<#E::table::service.db.users::columns::nickname>" | 
					
						
							|  |  |  | ENTITY_LINK_FNAME = "<#E::table::service.db.users::columns::first name>" | 
					
						
							|  |  |  | ENTITY_LINK_AGE = "<#E::table::service.db.users::columns::age>" | 
					
						
							|  |  |  | ENTITY_LINK_NAME = "<#E::table::service.db.users::columns::name>" | 
					
						
							|  |  |  | ENTITY_LINK_USER = "<#E::table::service.db.users>" | 
					
						
							| 
									
										
										
										
											2023-04-04 17:16:44 +02:00
										 |  |  | ENTITY_LINK_INSERTED_DATE = "<#E::table::service.db.users::columns::inserted_date>" | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  | ENTITY_LINK_EXPECTED_LOCATION = "<#E::table::service.db.users::columns::postal_code>" | 
					
						
							| 
									
										
										
										
											2025-07-25 15:17:38 +02:00
										 |  |  | ENTITY_LINK_IS_ACTIVE = "<#E::table::service.db.users::columns::is_active>" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | TABLE = Table( | 
					
						
							|  |  |  |     id=uuid4(), | 
					
						
							|  |  |  |     name="users", | 
					
						
							|  |  |  |     fullyQualifiedName="service.db.users", | 
					
						
							|  |  |  |     columns=[ | 
					
						
							|  |  |  |         Column(name="id", dataType=DataType.INT),  # type: ignore | 
					
						
							|  |  |  |         Column(name="name", dataType=DataType.STRING),  # type: ignore | 
					
						
							|  |  |  |         Column(name="first name", dataType=DataType.STRING),  # type: ignore | 
					
						
							|  |  |  |         Column(name="fullname", dataType=DataType.STRING),  # type: ignore | 
					
						
							|  |  |  |         Column(name="nickname", dataType=DataType.STRING),  # type: ignore | 
					
						
							|  |  |  |         Column(name="age", dataType=DataType.INT),  # type: ignore | 
					
						
							|  |  |  |         Column(name="inserted_date", dataType=DataType.DATE),  # type: ignore | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  |         Column(name="postal_code", dataType=DataType.INT),  # type: ignore | 
					
						
							|  |  |  |         Column(name="lat", dataType=DataType.DECIMAL),  # type: ignore | 
					
						
							|  |  |  |         Column(name="lon", dataType=DataType.DECIMAL),  # type: ignore | 
					
						
							| 
									
										
										
										
											2025-07-25 15:17:38 +02:00
										 |  |  |         Column(name="is_active", dataType=DataType.BOOLEAN),  # type: ignore | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     ], | 
					
						
							|  |  |  |     database=EntityReference(id=uuid4(), name="db", type="database"),  # type: ignore | 
					
						
							|  |  |  | )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class User(Base): | 
					
						
							|  |  |  |     __tablename__ = "users" | 
					
						
							|  |  |  |     id = sqa.Column(sqa.Integer, primary_key=True) | 
					
						
							|  |  |  |     name = sqa.Column(sqa.String(256)) | 
					
						
							|  |  |  |     first_name = sqa.Column("first name", sqa.String(256)) | 
					
						
							|  |  |  |     fullname = sqa.Column(sqa.String(256)) | 
					
						
							|  |  |  |     nickname = sqa.Column(sqa.String(256)) | 
					
						
							|  |  |  |     age = sqa.Column(sqa.Integer) | 
					
						
							|  |  |  |     inserted_date = sqa.Column(sqa.DATE) | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  |     postal_code = sqa.Column(sqa.INT) | 
					
						
							|  |  |  |     lat = sqa.Column(sqa.DECIMAL) | 
					
						
							|  |  |  |     lon = sqa.Column(sqa.DECIMAL) | 
					
						
							| 
									
										
										
										
											2025-07-25 15:17:38 +02:00
										 |  |  |     is_active = sqa.Column(sqa.BOOLEAN) | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def create_sqlite_table(): | 
					
						
							|  |  |  |     """create and delete sqlite table""" | 
					
						
							|  |  |  |     db_path = os.path.join( | 
					
						
							|  |  |  |         os.path.dirname(__file__), f"{os.path.splitext(__file__)[0]}.db" | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     sqlite_conn = SQLiteConnection( | 
					
						
							|  |  |  |         scheme=SQLiteScheme.sqlite_pysqlite, | 
					
						
							|  |  |  |         databaseMode=db_path + "?check_same_thread=False", | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-27 08:50:54 +01:00
										 |  |  |     with patch.object(SQASampler, "build_table_orm", return_value=User): | 
					
						
							|  |  |  |         sampler = SQASampler( | 
					
						
							|  |  |  |             service_connection_config=sqlite_conn, | 
					
						
							|  |  |  |             ometa_client=None, | 
					
						
							|  |  |  |             entity=TABLE, | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2024-11-19 08:10:45 +01:00
										 |  |  |     sqa_profiler_interface = SQATestSuiteInterface( | 
					
						
							|  |  |  |         sqlite_conn, | 
					
						
							|  |  |  |         None, | 
					
						
							|  |  |  |         sampler, | 
					
						
							|  |  |  |         TABLE, | 
					
						
							| 
									
										
										
										
											2024-11-27 16:25:12 +01:00
										 |  |  |         validator_builder=ValidatorBuilder, | 
					
						
							| 
									
										
										
										
											2024-11-19 08:10:45 +01:00
										 |  |  |     ) | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     runner = sqa_profiler_interface.runner | 
					
						
							|  |  |  |     engine = sqa_profiler_interface.session.get_bind() | 
					
						
							|  |  |  |     session = sqa_profiler_interface.session | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     User.__table__.create(bind=engine) | 
					
						
							|  |  |  |     for i in range(10): | 
					
						
							|  |  |  |         data = [ | 
					
						
							|  |  |  |             User( | 
					
						
							|  |  |  |                 name="John", | 
					
						
							|  |  |  |                 first_name="Jo", | 
					
						
							|  |  |  |                 fullname="John Doe", | 
					
						
							| 
									
										
										
										
											2024-04-25 09:45:26 +05:30
										 |  |  |                 nickname="", | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |                 age=30, | 
					
						
							|  |  |  |                 inserted_date=datetime.today() - timedelta(days=i), | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  |                 postal_code=60001, | 
					
						
							|  |  |  |                 lat=49.6852237, | 
					
						
							|  |  |  |                 lon=1.7743058, | 
					
						
							| 
									
										
										
										
											2025-07-25 15:17:38 +02:00
										 |  |  |                 is_active=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |             ), | 
					
						
							|  |  |  |             User( | 
					
						
							|  |  |  |                 name="Jane", | 
					
						
							|  |  |  |                 first_name="Ja", | 
					
						
							|  |  |  |                 fullname="Jone Doe", | 
					
						
							|  |  |  |                 nickname="Johnny d", | 
					
						
							|  |  |  |                 age=31, | 
					
						
							|  |  |  |                 inserted_date=datetime.today() - timedelta(days=i), | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  |                 postal_code=19005, | 
					
						
							|  |  |  |                 lat=45.2589385, | 
					
						
							|  |  |  |                 lon=1.4731471, | 
					
						
							| 
									
										
										
										
											2025-07-25 15:17:38 +02:00
										 |  |  |                 is_active=False, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |             ), | 
					
						
							|  |  |  |             User( | 
					
						
							|  |  |  |                 name="John", | 
					
						
							|  |  |  |                 first_name="Joh", | 
					
						
							|  |  |  |                 fullname="John Doe", | 
					
						
							|  |  |  |                 nickname=None, | 
					
						
							|  |  |  |                 age=None, | 
					
						
							|  |  |  |                 inserted_date=datetime.today() - timedelta(days=i), | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  |                 postal_code=11008, | 
					
						
							|  |  |  |                 lat=42.9974445, | 
					
						
							|  |  |  |                 lon=2.2518325, | 
					
						
							| 
									
										
										
										
											2025-07-25 15:17:38 +02:00
										 |  |  |                 is_active=None, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |             ), | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |         session.add_all(data) | 
					
						
							|  |  |  |         session.commit() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 06:40:49 +02:00
										 |  |  |     runner.service_connection = sqlite_conn | 
					
						
							|  |  |  |     runner.entity = TABLE | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     yield runner | 
					
						
							|  |  |  |     # clean up | 
					
						
							|  |  |  |     User.__table__.drop(bind=engine) | 
					
						
							|  |  |  |     os.remove(db_path) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_length_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_length_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NICKNAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minLength", value="1"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxLength", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_length_to_be_between_col_space(): | 
					
						
							|  |  |  |     """Test case for test column_value_length_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_FNAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minLength", value="1"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxLength", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_length_to_be_between_no_min(): | 
					
						
							|  |  |  |     """Test case for test column_value_length_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_FNAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxLength", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_max_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_max_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValueForMaxInCol", value="1"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForMaxInCol", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_max_to_be_between_no_min(): | 
					
						
							|  |  |  |     """Test case for test column_value_max_to_be_between_no_min""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForMaxInCol", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_mean_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_mean_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValueForMeanInCol", value="1"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForMeanInCol", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_mean_to_be_between_no_max(): | 
					
						
							|  |  |  |     """Test case for test column_value_mean_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValueForMeanInCol", value="1"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_median_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValueForMedianInCol", value="1"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForMedianInCol", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_min_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValueForMinInCol", value="25"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForMinInCol", value="40"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_min_to_be_between_no_min(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForMinInCol", value="40"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_stddev_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValueForStdDevInCol", value="20"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForStdDevInCol", value="40"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_stddev_to_be_between_no_min(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForStdDevInCol", value="40"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_in_set(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="allowedValues", value="['John']"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_missing_count_to_be_equal(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NICKNAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="missingCountValue", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							| 
									
										
										
										
											2023-02-22 09:42:34 +01:00
										 |  |  | def test_case_column_values_missing_count_to_be_equal_missing_values(): | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NICKNAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="missingCountValue", value="10"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="missingValueMatch", value="['Johnny d']"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_not_in_set(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="forbiddenValues", value="['John']"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_sum_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValueForColSum", value="10"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValueForColSum", value="100"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_AGE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValue", value="29"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValue", value="33"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_be_not_null(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NICKNAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_be_unique(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NICKNAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_match_regex(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="regex", value="J.*"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_not_match_regex(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="forbiddenRegex", value="X%"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_column_count_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minColValue", value="2"), | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  |             TestCaseParameterValue(name="maxColValue", value="11"), | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_column_count_to_equal(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[TestCaseParameterValue(name="columnCount", value="8")], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_column_name_to_exist(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[TestCaseParameterValue(name="columnName", value="id")], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_to_match_set(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="columnNames", value="id,name,nickname") | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_to_match_set_ordered(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="columnNames", value="id,name,nickname,fullname,age" | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="ordered", value="True"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_query(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_NAME, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="sqlExpression", value="SELECT * FROM users WHERE age > 20" | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_query_success(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="sqlExpression", value="SELECT * FROM users WHERE age < 0" | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-02 09:41:31 +02:00
										 |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_query_with_threshold_success(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="sqlExpression", value="SELECT COUNT(*) FROM users WHERE age > 30" | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="strategy", | 
					
						
							|  |  |  |                 value="COUNT", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="threshold", | 
					
						
							|  |  |  |                 value="20", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_unsafe_query_aborted(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="sqlExpression", | 
					
						
							|  |  |  |                 value="DELETE FROM airflow_task_instance WHERE dag_id = 'test_dag_id'", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="strategy", | 
					
						
							|  |  |  |                 value="COUNT", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="threshold", | 
					
						
							|  |  |  |                 value="20", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 06:40:49 +02:00
										 |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_with_partition_condition(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="sqlExpression", | 
					
						
							|  |  |  |                 value="SELECT * FROM users WHERE age > 20 AND name = 'John'", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="strategy", | 
					
						
							|  |  |  |                 value="ROWS", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="partitionExpression", | 
					
						
							|  |  |  |                 value="name = 'John'", | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-31 15:57:51 +01:00
										 |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_row_count_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValue", value="10"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValue", value="35"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_row_count_to_be_equal(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="value", value="10"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_row_inserted_count_to_be_between(): | 
					
						
							|  |  |  |     """Test case for test column_value_median_to_be_between""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="min", value="3"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="columnName", value="inserted_date"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="rangeType", value="DAY"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="rangeInterval", value="1"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							| 
									
										
										
										
											2023-02-22 09:42:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_query_failed_dl(): | 
					
						
							|  |  |  |     """Test case for test custom SQL table test""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="sqlExpression", value="age > 30"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_query_success_dl(): | 
					
						
							|  |  |  |     """Test case for test custom SQL table test""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="sqlExpression", value="age < 0"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2023-04-04 17:16:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 06:40:49 +02:00
										 |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_table_custom_sql_query_success_dl_with_partition_expression(): | 
					
						
							|  |  |  |     """Test case for test custom SQL table test""" | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_USER, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="sqlExpression", value="age < 0"), | 
					
						
							|  |  |  |             TestCaseParameterValue( | 
					
						
							|  |  |  |                 name="partitionExpression", value="nickname == 'johnny b goode'" | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-04 17:16:44 +02:00
										 |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_be_between_date(): | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_INSERTED_DATE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValue", value="1625127852000"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValue", value="1625127852000"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-12-27 13:38:51 +01:00
										 |  |  |         computePassedFailedRowCount=True, | 
					
						
							| 
									
										
										
										
											2023-04-04 17:16:44 +02:00
										 |  |  |     )  # type: ignore | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_be_between_datetime(): | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_INSERTED_DATE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="minValue", value="1625127852000"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="maxValue", value="1625171052000"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							| 
									
										
										
										
											2024-11-06 11:17:13 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_values_to_be_at_expected_location(): | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_EXPECTED_LOCATION, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="locationReferenceType", value="POSTAL_CODE"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="longitudeColumnName", value="lon"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="latitudeColumnName", value="lat"), | 
					
						
							|  |  |  |             TestCaseParameterValue(name="radius", value="1000"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         computePassedFailedRowCount=True, | 
					
						
							|  |  |  |     )  # type: ignore | 
					
						
							| 
									
										
										
										
											2025-07-25 15:17:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @pytest.fixture | 
					
						
							|  |  |  | def test_case_column_value_in_set_boolean(): | 
					
						
							|  |  |  |     return TestCase( | 
					
						
							|  |  |  |         name=TEST_CASE_NAME, | 
					
						
							|  |  |  |         entityLink=ENTITY_LINK_IS_ACTIVE, | 
					
						
							|  |  |  |         testSuite=EntityReference(id=uuid4(), type="TestSuite"),  # type: ignore | 
					
						
							|  |  |  |         testDefinition=EntityReference(id=uuid4(), type="TestDefinition"),  # type: ignore | 
					
						
							|  |  |  |         parameterValues=[ | 
					
						
							|  |  |  |             TestCaseParameterValue(name="allowedValues", value="[True, False]"), | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         computePassedFailedRowCount=True, | 
					
						
							|  |  |  |     ) |