Skip to content

Commit

Permalink
Remove experimental parser tests (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare authored Feb 12, 2024
1 parent deb4e09 commit 3b8647c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 350 deletions.
304 changes: 0 additions & 304 deletions tests/functional/test_experimental_parser.py

This file was deleted.

46 changes: 0 additions & 46 deletions tests/unit/test_adapter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import dataclasses
from multiprocessing import get_context
from unittest import TestCase, mock

import agate
from dbt.adapters.base import BaseRelation
from dbt.adapters.contracts.relation import Path
from dbt_common.exceptions import DbtValidationError

from dbt.adapters.postgres import Plugin as PostgresPlugin, PostgresAdapter
Expand Down Expand Up @@ -306,45 +302,3 @@ def test_set_zero_keepalive(self, psycopg2):
connect_timeout=10,
application_name="dbt",
)

@mock.patch.object(PostgresAdapter, "execute_macro")
@mock.patch.object(PostgresAdapter, "_get_catalog_relations")
def test_get_catalog_various_schemas(self, mock_get_relations, mock_execute):
self.catalog_test(mock_get_relations, mock_execute, False)

@mock.patch.object(PostgresAdapter, "execute_macro")
@mock.patch.object(PostgresAdapter, "_get_catalog_relations")
def test_get_filtered_catalog(self, mock_get_relations, mock_execute):
self.catalog_test(mock_get_relations, mock_execute, True)

def catalog_test(self, mock_get_relations, mock_execute, filtered=False):
column_names = ["table_database", "table_schema", "table_name"]
relations = [
BaseRelation(path=Path(database="dbt", schema="foo", identifier="bar")),
BaseRelation(path=Path(database="dbt", schema="FOO", identifier="baz")),
BaseRelation(path=Path(database="dbt", schema=None, identifier="bar")),
BaseRelation(path=Path(database="dbt", schema="quux", identifier="bar")),
BaseRelation(path=Path(database="dbt", schema="skip", identifier="bar")),
]
rows = list(map(lambda x: dataclasses.astuple(x.path), relations))
mock_execute.return_value = agate.Table(rows=rows, column_names=column_names)

mock_get_relations.return_value = relations

relation_configs = []
used_schemas = {("dbt", "foo"), ("dbt", "quux")}

if filtered:
catalog, exceptions = self.adapter.get_filtered_catalog(
relation_configs, used_schemas, set([relations[0], relations[3]])
)
else:
catalog, exceptions = self.adapter.get_catalog(relation_configs, used_schemas)

tupled_catalog = set(map(tuple, catalog))
if filtered:
self.assertEqual(tupled_catalog, {rows[0], rows[3]})
else:
self.assertEqual(tupled_catalog, {rows[0], rows[1], rows[3]})

self.assertEqual(exceptions, [])

0 comments on commit 3b8647c

Please sign in to comment.