Skip to content

Commit

Permalink
fix: eliminate the usage of NIT
Browse files Browse the repository at this point in the history
  • Loading branch information
datnguye committed Mar 30, 2024
1 parent 0aa2b65 commit 13c5781
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
7 changes: 0 additions & 7 deletions dbterd/adapters/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
from pathlib import Path
from types import NotImplementedType
from typing import List, Tuple

import click
Expand Down Expand Up @@ -239,9 +238,6 @@ def __run_by_strategy(
if not kwargs.get("api"):
self.__save_result(path=kwargs.get("output"), data=result)

if type(result) == NotImplementedType:
return result

return result[1]

def __run_metadata_by_strategy(self, **kwargs) -> Tuple[List[Table], List[Ref]]:
Expand All @@ -254,7 +250,4 @@ def __run_metadata_by_strategy(self, **kwargs) -> Tuple[List[Table], List[Ref]]:
if not kwargs.get("api"):
self.__save_result(path=kwargs.get("output"), data=result)

if type(result) == NotImplementedType:
return result

return result[1]
4 changes: 2 additions & 2 deletions dbterd/adapters/targets/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ def default(**kwargs):
"""Fallback option if the target is not supported yet
Returns:
NotImplemented: NotImplemented
Tuple[None, None]
"""
return NotImplemented
return (None, None)
3 changes: 1 addition & 2 deletions tests/unit/adapters/test_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pathlib import Path
from types import NotImplementedType
from unittest import mock

import click
Expand Down Expand Up @@ -36,7 +35,7 @@ def test___run_metadata_by_strategy_with_not_implemented_algo(
result = Executor(
ctx=click.Context(command=click.BaseCommand("dummy"))
)._Executor__run_metadata_by_strategy(target="dbml", algo="notfound")
assert type(result) == NotImplementedType
assert result is None
mock_query_erd_data.assert_called_once()
mock_save_result.assert_called_once()

Expand Down

0 comments on commit 13c5781

Please sign in to comment.