Fix mypy failures in PR #604

This commit is contained in:
Taj Khattra 2023-12-06 17:12:43 -08:00
commit cfecbce71f
2 changed files with 3 additions and 4 deletions

View file

@ -538,11 +538,10 @@ class Database:
: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:
"""

View file

@ -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