From cfecbce71f441ea041b6516cdb65c2dc8e0c67ae Mon Sep 17 00:00:00 2001 From: Taj Khattra Date: Wed, 6 Dec 2023 17:12:43 -0800 Subject: [PATCH] Fix mypy failures in PR #604 --- sqlite_utils/db.py | 5 ++--- tests/test_lookup.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 5e6a72a..04e04a1 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -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: """ diff --git a/tests/test_lookup.py b/tests/test_lookup.py index c3855d9..b5ae61f 100644 --- a/tests/test_lookup.py +++ b/tests/test_lookup.py @@ -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