diff --git a/databuilder/models/table_column_usage.py b/databuilder/models/table_column_usage.py index 08aed72bc..4aef0a6a0 100644 --- a/databuilder/models/table_column_usage.py +++ b/databuilder/models/table_column_usage.py @@ -26,12 +26,12 @@ def __init__(self, user_email: str, read_count: int = 1 ) -> None: - self.database = database.lower() - self.cluster = cluster.lower() - self.schema = schema.lower() - self.table = table.lower() - self.column = column.lower() - self.user_email = user_email.lower() + self.database = database + self.cluster = cluster + self.schema = schema + self.table = table + self.column = column + self.user_email = user_email self.read_count = read_count def __repr__(self) -> str: diff --git a/databuilder/models/table_lineage.py b/databuilder/models/table_lineage.py index 7b75f73ff..ff35d455e 100644 --- a/databuilder/models/table_lineage.py +++ b/databuilder/models/table_lineage.py @@ -27,11 +27,10 @@ def __init__(self, cluster: str, downstream_deps: List=None, ) -> None: - self.db = db_name.lower() - self.schema = schema.lower() - self.table = table_name.lower() - - self.cluster = cluster.lower() if cluster else 'gold' + self.db = db_name + self.schema = schema + self.table = table_name + self.cluster = cluster if cluster else 'gold' # a list of downstream dependencies, each of which will follow # the same key self.downstream_deps = downstream_deps or [] diff --git a/databuilder/models/table_owner.py b/databuilder/models/table_owner.py index 3bd78f061..066f49ce7 100644 --- a/databuilder/models/table_owner.py +++ b/databuilder/models/table_owner.py @@ -24,14 +24,14 @@ def __init__(self, owners: Union[List, str], cluster: str = 'gold', ) -> None: - self.db = db_name.lower() - self.schema = schema.lower() - self.table = table_name.lower() + self.db = db_name + self.schema = schema + self.table = table_name if isinstance(owners, str): owners = owners.split(',') - self.owners = [owner.lower().strip() for owner in owners] + self.owners = [owner.strip() for owner in owners] - self.cluster = cluster.lower() + self.cluster = cluster self._node_iter = iter(self.create_nodes()) self._relation_iter = iter(self.create_relation()) diff --git a/databuilder/models/table_source.py b/databuilder/models/table_source.py index 03b6fd808..f24a1c359 100644 --- a/databuilder/models/table_source.py +++ b/databuilder/models/table_source.py @@ -27,11 +27,11 @@ def __init__(self, source: str, source_type: str='github', ) -> None: - self.db = db_name.lower() - self.schema = schema.lower() - self.table = table_name.lower() + self.db = db_name + self.schema = schema + self.table = table_name - self.cluster = cluster.lower() if cluster else 'gold' + self.cluster = cluster if cluster else 'gold' # source is the source file location self.source = source self.source_type = source_type diff --git a/databuilder/models/table_stats.py b/databuilder/models/table_stats.py index a99bdbe67..6cacef671 100644 --- a/databuilder/models/table_stats.py +++ b/databuilder/models/table_stats.py @@ -34,10 +34,10 @@ def __init__(self, if schema is None: self.schema, self.table = table_name.split('.') else: - self.table = table_name.lower() - self.schema = schema.lower() + self.table = table_name + self.schema = schema self.db = db - self.col_name = col_name.lower() + self.col_name = col_name self.start_epoch = start_epoch self.end_epoch = end_epoch self.cluster = cluster diff --git a/databuilder/models/watermark.py b/databuilder/models/watermark.py index 623d25244..8b71d8e8e 100644 --- a/databuilder/models/watermark.py +++ b/databuilder/models/watermark.py @@ -25,13 +25,13 @@ def __init__(self, schema: str, table_name: str, part_name: str, - part_type: str='high_watermark', - cluster: str='gold', + part_type: str = 'high_watermark', + cluster: str = 'gold', ) -> None: self.create_time = create_time - self.database = database.lower() - self.schema = schema.lower() - self.table = table_name.lower() + self.database = database + self.schema = schema + self.table = table_name self.parts: List[Tuple[str, str]] = [] if '=' not in part_name: @@ -39,10 +39,10 @@ def __init__(self, # currently we don't consider nested partitions idx = part_name.find('=') - name, value = part_name.lower()[:idx], part_name.lower()[idx + 1:] + name, value = part_name[:idx], part_name[idx + 1:] self.parts = [(name, value)] - self.part_type = part_type.lower() - self.cluster = cluster.lower() + self.part_type = part_type + self.cluster = cluster self._node_iter = iter(self.create_nodes()) self._relation_iter = iter(self.create_relation()) diff --git a/tests/unit/extractor/dashboard/mode_analytics/batch/test_mode_dashboard_charts_batch_extractor.py b/tests/unit/extractor/dashboard/mode_analytics/batch/test_mode_dashboard_charts_batch_extractor.py index c5011d3c8..ac5522996 100644 --- a/tests/unit/extractor/dashboard/mode_analytics/batch/test_mode_dashboard_charts_batch_extractor.py +++ b/tests/unit/extractor/dashboard/mode_analytics/batch/test_mode_dashboard_charts_batch_extractor.py @@ -48,10 +48,10 @@ def test_dashboard_chart_extractor_actual_record(self) -> None: } record = extractor.extract() - self.assertEquals(record._dashboard_group_id, 'ggg') - self.assertEquals(record._dashboard_id, 'ddd') - self.assertEquals(record._chart_name, 'some chart') - self.assertEquals(record._product, 'mode') + self.assertEqual(record._dashboard_group_id, 'ggg') + self.assertEqual(record._dashboard_id, 'ddd') + self.assertEqual(record._chart_name, 'some chart') + self.assertEqual(record._product, 'mode') if __name__ == '__main__': diff --git a/tests/unit/extractor/test_bigquery_metadata_extractor.py b/tests/unit/extractor/test_bigquery_metadata_extractor.py index 09de37224..810fe37b3 100644 --- a/tests/unit/extractor/test_bigquery_metadata_extractor.py +++ b/tests/unit/extractor/test_bigquery_metadata_extractor.py @@ -194,13 +194,13 @@ def test_table_without_schema(self, mock_build: Any) -> None: scope=extractor.get_scope())) result = extractor.extract() - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.name, 'nested_recs') - self.assertEquals(result.description._text, '') - self.assertEquals(result.columns, []) - self.assertEquals(result.is_view, False) + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.name, 'nested_recs') + self.assertEqual(result.description._text, '') + self.assertEqual(result.columns, []) + self.assertEqual(result.is_view, False) @patch('databuilder.extractor.base_bigquery_extractor.build') def test_table_without_columns(self, mock_build: Any) -> None: @@ -210,13 +210,13 @@ def test_table_without_columns(self, mock_build: Any) -> None: scope=extractor.get_scope())) result = extractor.extract() - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.name, 'nested_recs') - self.assertEquals(result.description._text, "") - self.assertEquals(result.columns, []) - self.assertEquals(result.is_view, False) + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.name, 'nested_recs') + self.assertEqual(result.description._text, "") + self.assertEqual(result.columns, []) + self.assertEqual(result.is_view, False) @patch('databuilder.extractor.base_bigquery_extractor.build') def test_view(self, mock_build: Any) -> None: @@ -226,7 +226,7 @@ def test_view(self, mock_build: Any) -> None: scope=extractor.get_scope())) result = extractor.extract() self.assertIsInstance(result, TableMetadata) - self.assertEquals(result.is_view, True) + self.assertEqual(result.is_view, True) @patch('databuilder.extractor.base_bigquery_extractor.build') def test_normal_table(self, mock_build: Any) -> None: @@ -236,17 +236,17 @@ def test_normal_table(self, mock_build: Any) -> None: scope=extractor.get_scope())) result = extractor.extract() - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.name, 'nested_recs') - self.assertEquals(result.description._text, "") + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.name, 'nested_recs') + self.assertEqual(result.description._text, "") first_col = result.columns[0] - self.assertEquals(first_col.name, 'test') - self.assertEquals(first_col.type, 'STRING') - self.assertEquals(first_col.description._text, 'some_description') - self.assertEquals(result.is_view, False) + self.assertEqual(first_col.name, 'test') + self.assertEqual(first_col.type, 'STRING') + self.assertEqual(first_col.description._text, 'some_description') + self.assertEqual(result.is_view, False) @patch('databuilder.extractor.base_bigquery_extractor.build') def test_table_with_nested_records(self, mock_build: Any) -> None: @@ -257,14 +257,14 @@ def test_table_with_nested_records(self, mock_build: Any) -> None: result = extractor.extract() first_col = result.columns[0] - self.assertEquals(first_col.name, 'nested') - self.assertEquals(first_col.type, 'RECORD') + self.assertEqual(first_col.name, 'nested') + self.assertEqual(first_col.type, 'RECORD') second_col = result.columns[1] - self.assertEquals(second_col.name, 'nested.nested2') - self.assertEquals(second_col.type, 'RECORD') + self.assertEqual(second_col.name, 'nested.nested2') + self.assertEqual(second_col.type, 'RECORD') third_col = result.columns[2] - self.assertEquals(third_col.name, 'nested.nested2.ahah') - self.assertEquals(third_col.type, 'STRING') + self.assertEqual(third_col.name, 'nested.nested2.ahah') + self.assertEqual(third_col.type, 'STRING') @patch('databuilder.extractor.base_bigquery_extractor.build') def test_keypath_and_pagesize_can_be_set(self, mock_build: Any) -> None: @@ -299,5 +299,5 @@ def test_table_part_of_table_date_range(self, mock_build: Any) -> None: count += 1 result = extractor.extract() - self.assertEquals(count, 1) - self.assertEquals(table_name, 'date_range_') + self.assertEqual(count, 1) + self.assertEqual(table_name, 'date_range_') diff --git a/tests/unit/extractor/test_bigquery_watermark_extractor.py b/tests/unit/extractor/test_bigquery_watermark_extractor.py index 57306a6fe..b1310a575 100644 --- a/tests/unit/extractor/test_bigquery_watermark_extractor.py +++ b/tests/unit/extractor/test_bigquery_watermark_extractor.py @@ -131,22 +131,22 @@ def test_table_with_default_partitions(self, mock_build: Any) -> None: extractor.init(Scoped.get_scoped_conf(conf=self.conf, scope=extractor.get_scope())) result = extractor.extract() - self.assertEquals(result.part_type, 'low_watermark') - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.table, 'other') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) - self.assertEquals(result.parts, [('_partitiontime', '20180802')]) + self.assertEqual(result.part_type, 'low_watermark') + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.table, 'other') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) + self.assertEqual(result.parts, [('_PARTITIONTIME', '20180802')]) result = extractor.extract() - self.assertEquals(result.part_type, 'high_watermark') - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.table, 'other') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) - self.assertEquals(result.parts, [('_partitiontime', '20180804')]) + self.assertEqual(result.part_type, 'high_watermark') + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.table, 'other') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) + self.assertEqual(result.parts, [('_PARTITIONTIME', '20180804')]) @patch('databuilder.extractor.base_bigquery_extractor.build') def test_table_with_field_partitions(self, mock_build: Any) -> None: @@ -156,23 +156,23 @@ def test_table_with_field_partitions(self, mock_build: Any) -> None: scope=extractor.get_scope())) result = extractor.extract() assert result is not None - self.assertEquals(result.part_type, 'low_watermark') - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.table, 'other') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) - self.assertEquals(result.parts, [('processed_date', '20180802')]) + self.assertEqual(result.part_type, 'low_watermark') + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.table, 'other') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) + self.assertEqual(result.parts, [('processed_date', '20180802')]) result = extractor.extract() assert result is not None - self.assertEquals(result.part_type, 'high_watermark') - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.table, 'other') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) - self.assertEquals(result.parts, [('processed_date', '20180804')]) + self.assertEqual(result.part_type, 'high_watermark') + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.table, 'other') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.create_time, datetime.fromtimestamp(1547512241).strftime('%Y-%m-%d %H:%M:%S')) + self.assertEqual(result.parts, [('processed_date', '20180804')]) @patch('databuilder.extractor.base_bigquery_extractor.build') def test_keypath_can_be_set(self, mock_build: Any) -> None: @@ -200,20 +200,20 @@ def test_table_part_of_table_date_range(self, mock_build: Any) -> None: result = extractor.extract() assert result is not None - self.assertEquals(result.part_type, 'low_watermark') - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.table, 'date_range_') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.create_time, datetime.fromtimestamp(1557577779).strftime('%Y-%m-%d %H:%M:%S')) - self.assertEquals(result.parts, [('__table__', '20190101')]) + self.assertEqual(result.part_type, 'low_watermark') + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.table, 'date_range_') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.create_time, datetime.fromtimestamp(1557577779).strftime('%Y-%m-%d %H:%M:%S')) + self.assertEqual(result.parts, [('__table__', '20190101')]) result = extractor.extract() assert result is not None - self.assertEquals(result.part_type, 'high_watermark') - self.assertEquals(result.database, 'bigquery') - self.assertEquals(result.schema, 'fdgdfgh') - self.assertEquals(result.table, 'date_range_') - self.assertEquals(result.cluster, 'your-project-here') - self.assertEquals(result.create_time, datetime.fromtimestamp(1557577779).strftime('%Y-%m-%d %H:%M:%S')) - self.assertEquals(result.parts, [('__table__', '20190102')]) + self.assertEqual(result.part_type, 'high_watermark') + self.assertEqual(result.database, 'bigquery') + self.assertEqual(result.schema, 'fdgdfgh') + self.assertEqual(result.table, 'date_range_') + self.assertEqual(result.cluster, 'your-project-here') + self.assertEqual(result.create_time, datetime.fromtimestamp(1557577779).strftime('%Y-%m-%d %H:%M:%S')) + self.assertEqual(result.parts, [('__table__', '20190102')]) diff --git a/tests/unit/extractor/test_csv_extractor.py b/tests/unit/extractor/test_csv_extractor.py index 9a54898df..779880349 100644 --- a/tests/unit/extractor/test_csv_extractor.py +++ b/tests/unit/extractor/test_csv_extractor.py @@ -27,8 +27,8 @@ def test_extraction_with_model_class(self) -> None: scope=extractor.get_scope())) result = extractor.extract() - self.assertEquals(result.name, 'test_table1') - self.assertEquals(result.description._text, '1st test table') - self.assertEquals(result.database, 'hive') - self.assertEquals(result.cluster, 'gold') - self.assertEquals(result.schema, 'test_schema') + self.assertEqual(result.name, 'test_table1') + self.assertEqual(result.description._text, '1st test table') + self.assertEqual(result.database, 'hive') + self.assertEqual(result.cluster, 'gold') + self.assertEqual(result.schema, 'test_schema') diff --git a/tests/unit/extractor/test_generic_extractor.py b/tests/unit/extractor/test_generic_extractor.py index c63de359d..e34bc9ed8 100644 --- a/tests/unit/extractor/test_generic_extractor.py +++ b/tests/unit/extractor/test_generic_extractor.py @@ -28,7 +28,7 @@ def test_extraction_with_model_class(self) -> None: scope=extractor.get_scope())) result = extractor.extract() - self.assertEquals(result.timestamp, 10000000) + self.assertEqual(result.timestamp, 10000000) def test_extraction_without_model_class(self) -> None: """ @@ -44,5 +44,5 @@ def test_extraction_without_model_class(self) -> None: extractor.init(Scoped.get_scoped_conf(conf=conf, scope=extractor.get_scope())) - self.assertEquals(extractor.extract(), {'foo': 1}) - self.assertEquals(extractor.extract(), {'bar': 2}) + self.assertEqual(extractor.extract(), {'foo': 1}) + self.assertEqual(extractor.extract(), {'bar': 2}) diff --git a/tests/unit/extractor/test_neo4j_es_last_updated_extractor.py b/tests/unit/extractor/test_neo4j_es_last_updated_extractor.py index 690df3546..96af15902 100644 --- a/tests/unit/extractor/test_neo4j_es_last_updated_extractor.py +++ b/tests/unit/extractor/test_neo4j_es_last_updated_extractor.py @@ -31,4 +31,4 @@ def test_extraction_with_model_class(self, mock_time: Any) -> None: scope=extractor.get_scope())) result = extractor.extract() - self.assertEquals(result.timestamp, 10000000) + self.assertEqual(result.timestamp, 10000000) diff --git a/tests/unit/models/test_application.py b/tests/unit/models/test_application.py index 3be9bc843..fc7eef641 100644 --- a/tests/unit/models/test_application.py +++ b/tests/unit/models/test_application.py @@ -42,26 +42,26 @@ def setUp(self) -> None: def test_create_next_node(self) -> None: next_node = self.application.create_next_node() - self.assertEquals(next_node, self.expected_node_result) + self.assertEqual(next_node, self.expected_node_result) def test_create_next_relation(self) -> None: next_relation = self.application.create_next_relation() - self.assertEquals(next_relation, self.expected_relation_result) + self.assertEqual(next_relation, self.expected_relation_result) def test_get_table_model_key(self) -> None: table = self.application.get_table_model_key() - self.assertEquals(table, 'hive://gold.default/test_table') + self.assertEqual(table, 'hive://gold.default/test_table') def test_get_application_model_key(self) -> None: application = self.application.get_application_model_key() - self.assertEquals(application, self.expected_node_result[NODE_KEY]) + self.assertEqual(application, self.expected_node_result[NODE_KEY]) def test_create_nodes(self) -> None: nodes = self.application.create_nodes() - self.assertEquals(len(nodes), 1) - self.assertEquals(nodes[0], self.expected_node_result) + self.assertEqual(len(nodes), 1) + self.assertEqual(nodes[0], self.expected_node_result) def test_create_relation(self) -> None: relation = self.application.create_relation() - self.assertEquals(len(relation), 1) - self.assertEquals(relation[0], self.expected_relation_result) + self.assertEqual(len(relation), 1) + self.assertEqual(relation[0], self.expected_relation_result) diff --git a/tests/unit/models/test_neo4j_es_last_updated.py b/tests/unit/models/test_neo4j_es_last_updated.py index 82e96488c..1b9b2cce0 100644 --- a/tests/unit/models/test_neo4j_es_last_updated.py +++ b/tests/unit/models/test_neo4j_es_last_updated.py @@ -22,12 +22,12 @@ def setUp(self) -> None: def test_create_nodes(self) -> None: nodes = self.neo4j_es_last_updated.create_nodes() - self.assertEquals(len(nodes), 1) - self.assertEquals(nodes[0], self.expected_node_result) + self.assertEqual(len(nodes), 1) + self.assertEqual(nodes[0], self.expected_node_result) def test_create_next_node(self) -> None: next_node = self.neo4j_es_last_updated.create_next_node() - self.assertEquals(next_node, self.expected_node_result) + self.assertEqual(next_node, self.expected_node_result) def test_create_next_relation(self) -> None: self.assertIs(self.neo4j_es_last_updated.create_next_relation(), None) diff --git a/tests/unit/models/test_table_last_updated.py b/tests/unit/models/test_table_last_updated.py index 53cabdbc8..88a8ad571 100644 --- a/tests/unit/models/test_table_last_updated.py +++ b/tests/unit/models/test_table_last_updated.py @@ -46,18 +46,18 @@ def test_create_next_relation(self) -> None: def test_get_table_model_key(self) -> None: table = self.tableLastUpdated.get_table_model_key() - self.assertEquals(table, 'hive://gold.default/test_table') + self.assertEqual(table, 'hive://gold.default/test_table') def test_get_last_updated_model_key(self) -> None: last_updated = self.tableLastUpdated.get_last_updated_model_key() - self.assertEquals(last_updated, 'hive://gold.default/test_table/timestamp') + self.assertEqual(last_updated, 'hive://gold.default/test_table/timestamp') def test_create_nodes(self) -> None: nodes = self.tableLastUpdated.create_nodes() - self.assertEquals(len(nodes), 1) - self.assertEquals(nodes[0], self.expected_node_result) + self.assertEqual(len(nodes), 1) + self.assertEqual(nodes[0], self.expected_node_result) def test_create_relation(self) -> None: relation = self.tableLastUpdated.create_relation() - self.assertEquals(len(relation), 1) - self.assertEquals(relation[0], self.expected_relation_result) + self.assertEqual(len(relation), 1) + self.assertEqual(relation[0], self.expected_relation_result) diff --git a/tests/unit/models/test_table_lineage.py b/tests/unit/models/test_table_lineage.py index d4702defe..80f814cb5 100644 --- a/tests/unit/models/test_table_lineage.py +++ b/tests/unit/models/test_table_lineage.py @@ -30,15 +30,15 @@ def test_get_table_model_key(self) -> None: cluster=CLUSTER, schema=SCHEMA, table=TABLE) - self.assertEquals(metadata, 'hive://default.base/test') + self.assertEqual(metadata, 'hive://default.base/test') def test_create_nodes(self) -> None: nodes = self.table_lineage.create_nodes() - self.assertEquals(len(nodes), 0) + self.assertEqual(len(nodes), 0) def test_create_relation(self) -> None: relations = self.table_lineage.create_relation() - self.assertEquals(len(relations), 2) + self.assertEqual(len(relations), 2) start_key = '{db}://{cluster}.{schema}/{tbl}'.format(db=DB, schema=SCHEMA, diff --git a/tests/unit/models/test_table_owner.py b/tests/unit/models/test_table_owner.py index 554a5c0dd..98d58c519 100644 --- a/tests/unit/models/test_table_owner.py +++ b/tests/unit/models/test_table_owner.py @@ -27,19 +27,19 @@ def setUp(self) -> None: schema=SCHEMA, table_name=TABLE, cluster=CLUSTER, - owners="user1@1, UsER2@2 ") + owners="user1@1, user2@2 ") def test_get_owner_model_key(self) -> None: owner = self.table_owner.get_owner_model_key(owner1) - self.assertEquals(owner, owner1) + self.assertEqual(owner, owner1) def test_get_metadata_model_key(self) -> None: metadata = self.table_owner.get_metadata_model_key() - self.assertEquals(metadata, 'hive://default.base/test') + self.assertEqual(metadata, 'hive://DEFAULT.BASE/TEST') def test_create_nodes(self) -> None: nodes = self.table_owner.create_nodes() - self.assertEquals(len(nodes), 2) + self.assertEqual(len(nodes), 2) node1 = { NODE_KEY: User.USER_NODE_KEY_FORMAT.format(email=owner1), @@ -57,7 +57,7 @@ def test_create_nodes(self) -> None: def test_create_relation(self) -> None: relations = self.table_owner.create_relation() - self.assertEquals(len(relations), 2) + self.assertEqual(len(relations), 2) relation1 = { RELATION_START_KEY: owner1, @@ -84,9 +84,9 @@ def test_create_nodes_with_owners_list(self) -> None: schema=SCHEMA, table_name=TABLE, cluster=CLUSTER, - owners=['user1@1', ' UsER2@2 ']) + owners=['user1@1', ' user2@2 ']) nodes = self.table_owner_list.create_nodes() - self.assertEquals(len(nodes), 2) + self.assertEqual(len(nodes), 2) node1 = { NODE_KEY: User.USER_NODE_KEY_FORMAT.format(email=owner1), diff --git a/tests/unit/models/test_table_source.py b/tests/unit/models/test_table_source.py index 452854803..3b7f6ca72 100644 --- a/tests/unit/models/test_table_source.py +++ b/tests/unit/models/test_table_source.py @@ -27,23 +27,23 @@ def setUp(self) -> None: def test_get_source_model_key(self) -> None: source = self.table_source.get_source_model_key() - self.assertEquals(source, '{db}://{cluster}.{schema}/{tbl}/_source'.format(db=DB, - schema=SCHEMA, - tbl=TABLE, - cluster=CLUSTER, - )) + self.assertEqual(source, '{db}://{cluster}.{schema}/{tbl}/_source'.format(db=DB, + schema=SCHEMA, + tbl=TABLE, + cluster=CLUSTER, + )) def test_get_metadata_model_key(self) -> None: metadata = self.table_source.get_metadata_model_key() - self.assertEquals(metadata, 'hive://default.base/test') + self.assertEqual(metadata, 'hive://default.base/test') def test_create_nodes(self) -> None: nodes = self.table_source.create_nodes() - self.assertEquals(len(nodes), 1) + self.assertEqual(len(nodes), 1) def test_create_relation(self) -> None: relations = self.table_source.create_relation() - self.assertEquals(len(relations), 1) + self.assertEqual(len(relations), 1) start_key = '{db}://{cluster}.{schema}/{tbl}/_source'.format(db=DB, schema=SCHEMA, diff --git a/tests/unit/models/test_table_stats.py b/tests/unit/models/test_table_stats.py index 28b9723a0..4d5ba9652 100644 --- a/tests/unit/models/test_table_stats.py +++ b/tests/unit/models/test_table_stats.py @@ -40,26 +40,26 @@ def setUp(self) -> None: def test_get_table_stat_model_key(self) -> None: table_stats = self.table_stats.get_table_stat_model_key() - self.assertEquals(table_stats, 'hive://gold.base/test/col/avg/') + self.assertEqual(table_stats, 'hive://gold.base/test/col/avg/') def test_get_col_key(self) -> None: metadata = self.table_stats.get_col_key() - self.assertEquals(metadata, 'hive://gold.base/test/col') + self.assertEqual(metadata, 'hive://gold.base/test/col') def test_create_nodes(self) -> None: nodes = self.table_stats.create_nodes() - self.assertEquals(len(nodes), 1) - self.assertEquals(nodes[0], self.expected_node_result) + self.assertEqual(len(nodes), 1) + self.assertEqual(nodes[0], self.expected_node_result) def test_create_relation(self) -> None: relation = self.table_stats.create_relation() - self.assertEquals(len(relation), 1) - self.assertEquals(relation[0], self.expected_relation_result) + self.assertEqual(len(relation), 1) + self.assertEqual(relation[0], self.expected_relation_result) def test_create_next_node(self) -> None: next_node = self.table_stats.create_next_node() - self.assertEquals(next_node, self.expected_node_result) + self.assertEqual(next_node, self.expected_node_result) def test_create_next_relation(self) -> None: next_relation = self.table_stats.create_next_relation() - self.assertEquals(next_relation, self.expected_relation_result) + self.assertEqual(next_relation, self.expected_relation_result) diff --git a/tests/unit/models/test_user.py b/tests/unit/models/test_user.py index bd257e8c8..8dda34d87 100644 --- a/tests/unit/models/test_user.py +++ b/tests/unit/models/test_user.py @@ -27,11 +27,11 @@ def setUp(self) -> None: def test_get_user_model_key(self) -> None: user_email = User.get_user_model_key(email=self.user.email) - self.assertEquals(user_email, '{email}'.format(email='test@email.com')) + self.assertEqual(user_email, '{email}'.format(email='test@email.com')) def test_create_nodes(self) -> None: nodes = self.user.create_nodes() - self.assertEquals(len(nodes), 1) + self.assertEqual(len(nodes), 1) def test_create_node_additional_attr(self) -> None: test_user = User(first_name='test_first', @@ -54,7 +54,7 @@ def test_create_node_additional_attr(self) -> None: def test_create_relation(self) -> None: relations = self.user.create_relation() - self.assertEquals(len(relations), 1) + self.assertEqual(len(relations), 1) start_key = '{email}'.format(email='test@email.com') end_key = '{email}'.format(email='test_manager@email.com') diff --git a/tests/unit/models/test_watermark.py b/tests/unit/models/test_watermark.py index d881fef81..7fcfe7c1c 100644 --- a/tests/unit/models/test_watermark.py +++ b/tests/unit/models/test_watermark.py @@ -33,11 +33,11 @@ def setUp(self) -> None: self.expected_node_result = { NODE_KEY: '{database}://{cluster}.{schema}/{table}/{part_type}/' .format( - database=DATABASE.lower(), - cluster=CLUSTER.lower(), - schema=SCHEMA.lower(), - table=TABLE.lower(), - part_type=PART_TYPE.lower()), + database=DATABASE, + cluster=CLUSTER, + schema=SCHEMA, + table=TABLE, + part_type=PART_TYPE), NODE_LABEL: 'Watermark', 'partition_key': 'ds', 'partition_value': '2017-09-18/feature_id=9', @@ -47,18 +47,18 @@ def setUp(self) -> None: self.expected_relation_result = { RELATION_START_KEY: '{database}://{cluster}.{schema}/{table}/{part_type}/' .format( - database=DATABASE.lower(), - cluster=CLUSTER.lower(), - schema=SCHEMA.lower(), - table=TABLE.lower(), - part_type=PART_TYPE.lower()), + database=DATABASE, + cluster=CLUSTER, + schema=SCHEMA, + table=TABLE, + part_type=PART_TYPE), RELATION_START_LABEL: 'Watermark', RELATION_END_KEY: '{database}://{cluster}.{schema}/{table}' .format( - database=DATABASE.lower(), - cluster=CLUSTER.lower(), - schema=SCHEMA.lower(), - table=TABLE.lower()), + database=DATABASE, + cluster=CLUSTER, + schema=SCHEMA, + table=TABLE), RELATION_END_LABEL: 'Table', RELATION_TYPE: 'BELONG_TO_TABLE', RELATION_REVERSE_TYPE: 'WATERMARK' @@ -66,36 +66,36 @@ def setUp(self) -> None: def test_get_watermark_model_key(self) -> None: watermark = self.watermark.get_watermark_model_key() - self.assertEquals( + self.assertEqual( watermark, '{database}://{cluster}.{schema}/{table}/{part_type}/' - .format(database=DATABASE.lower(), - cluster=CLUSTER.lower(), - schema=SCHEMA.lower(), - table=TABLE.lower(), - part_type=PART_TYPE.lower())) + .format(database=DATABASE, + cluster=CLUSTER, + schema=SCHEMA, + table=TABLE, + part_type=PART_TYPE)) def test_get_metadata_model_key(self) -> None: metadata = self.watermark.get_metadata_model_key() - self.assertEquals(metadata, '{database}://{cluster}.{schema}/{table}' - .format(database=DATABASE.lower(), - cluster=CLUSTER.lower(), - schema=SCHEMA.lower(), - table=TABLE.lower())) + self.assertEqual(metadata, '{database}://{cluster}.{schema}/{table}' + .format(database=DATABASE, + cluster=CLUSTER, + schema=SCHEMA, + table=TABLE)) def test_create_nodes(self) -> None: nodes = self.watermark.create_nodes() - self.assertEquals(len(nodes), 1) - self.assertEquals(nodes[0], self.expected_node_result) + self.assertEqual(len(nodes), 1) + self.assertEqual(nodes[0], self.expected_node_result) def test_create_relation(self) -> None: relation = self.watermark.create_relation() - self.assertEquals(len(relation), 1) - self.assertEquals(relation[0], self.expected_relation_result) + self.assertEqual(len(relation), 1) + self.assertEqual(relation[0], self.expected_relation_result) def test_create_next_node(self) -> None: next_node = self.watermark.create_next_node() - self.assertEquals(next_node, self.expected_node_result) + self.assertEqual(next_node, self.expected_node_result) def test_create_next_relation(self) -> None: next_relation = self.watermark.create_next_relation() - self.assertEquals(next_relation, self.expected_relation_result) + self.assertEqual(next_relation, self.expected_relation_result) diff --git a/tests/unit/transformer/test_timestamp_string_to_epoch_transformer.py b/tests/unit/transformer/test_timestamp_string_to_epoch_transformer.py index 7095035b0..9ca10adf4 100644 --- a/tests/unit/transformer/test_timestamp_string_to_epoch_transformer.py +++ b/tests/unit/transformer/test_timestamp_string_to_epoch_transformer.py @@ -40,7 +40,7 @@ def test_invalid_timestamp(self) -> None: }) transformer.init(conf=config) actual = transformer.transform({'foo': '165de33266d4'}) - self.assertEquals(actual['foo'], 0) + self.assertEqual(actual['foo'], 0) if __name__ == '__main__':