diff --git a/dbt_meshify/storage/jinja_blocks.py b/dbt_meshify/storage/jinja_blocks.py index ddf7b17..dcc4630 100644 --- a/dbt_meshify/storage/jinja_blocks.py +++ b/dbt_meshify/storage/jinja_blocks.py @@ -51,7 +51,7 @@ def find_block_range(file_content: str, block_type: str, name: str) -> Tuple[int return start_line, end_line @staticmethod - def isolate_content_from_line_range(file_content: str, start: int, end: int) -> str: + def isolate_content(file_content: str, start: int, end: int) -> str: """Given content, a start position, and an end position, return the content of a Jinja block.""" return file_content[start:end] @@ -61,9 +61,7 @@ def from_file(cls, path: Path, block_type: str, name: str) -> "JinjaBlock": file_content = open(path).read() start, end = cls.find_block_range(file_content, block_type, name) - content = cls.isolate_content_from_line_range( - file_content=file_content, start=start, end=end - ) + content = cls.isolate_content(file_content=file_content, start=start, end=end) return cls( path=path, block_type=block_type, name=name, start=start, end=end, content=content diff --git a/tests/unit/test_jinja_blocks.py b/tests/unit/test_jinja_blocks.py index 020fc0c..6a8e896 100644 --- a/tests/unit/test_jinja_blocks.py +++ b/tests/unit/test_jinja_blocks.py @@ -27,7 +27,7 @@ def test_from_file_detects_block_range(self): assert range == (2, 72) def test_from_file_extracts_content(self): - content = JinjaBlock.isolate_content_from_line_range(string, 2, 72) + content = JinjaBlock.isolate_content(string, 2, 72) assert ( content == "{% docs customer_id %}\nThe unique key for each customer.\n{% enddocs %}" ) @@ -37,7 +37,7 @@ def test_from_file_detects_block_range_in_multiple_blocks(self): assert range == (74, 159) def test_from_file_extracts_content_in_files_with_multiple_blocks(self): - content = JinjaBlock.isolate_content_from_line_range(multiple_blocks, 74, 159) + content = JinjaBlock.isolate_content(multiple_blocks, 74, 159) assert ( content == "{% docs potato_name %}\nThe name of the customer's favorite potato dish.\n{% enddocs %}"