Skip to content

Commit

Permalink
Fix mypy failures in PR #604
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhattra committed Dec 7, 2023
1 parent e4b9b58 commit cfecbce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions sqlite_utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,10 @@ def table(self, table_name: str, **kwargs) -> Union["Table", "View"]:
:param table_name: Name of the table
"""
if table_name in self.view_names():
klass = View
return View(self, table_name, **kwargs)
else:
klass = Table
kwargs.setdefault("strict", self.strict)
return klass(self, table_name, **kwargs)
return Table(self, table_name, **kwargs)

def quote(self, value: str) -> str:
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ def test_lookup_with_extra_insert_parameters(fresh_db):


@pytest.mark.parametrize("strict", (False, True))
def test_lookup_new_table(fresh_db, strict):
def test_lookup_new_table_strict(fresh_db, strict):
fresh_db["species"].lookup({"name": "Palm"}, strict=strict)
assert fresh_db["species"].strict == strict or not fresh_db.supports_strict

0 comments on commit cfecbce

Please sign in to comment.