Skip to content

Commit

Permalink
quick refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke committed Nov 16, 2023
1 parent 31196b7 commit e9ad3d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/dbt/parser/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ def __init__(self, schema_parser: SchemaParser, yaml: YamlBlock) -> None:
self.schema_parser = schema_parser
self.yaml = yaml

def _load_rows_from_seed(self, ref: Dict[str, str]) -> List[Dict[str, Any]]:
def _load_rows_from_seed(self, ref_str: str) -> List[Dict[str, Any]]:
"""Read rows from seed file on disk if not specified in YAML config. If seed file doesn't exist, return empty list."""
ref = py_extract_from_source("{{ " + ref_str + " }}")["refs"][0]

rows: List[Dict[str, Any]] = []

seed_name = ref["name"]
Expand Down Expand Up @@ -263,8 +265,7 @@ def parse(self) -> ParseResult:
# Check that format and type of rows matches for each given input
for input in unit_test.given:
if input.rows is None and input.fixture is None:
ref = py_extract_from_source("{{ " + input.input + " }}")["refs"][0]
input.rows = self._load_rows_from_seed(ref)
input.rows = self._load_rows_from_seed(input.input)
input.validate_fixture("input", unit_test.name)
unit_test.expect.validate_fixture("expected", unit_test.name)

Expand Down

0 comments on commit e9ad3d2

Please sign in to comment.