Skip to content

Commit b8552fc

Browse files
committed
fix a few tests
1 parent 7a36e77 commit b8552fc

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

tests/fast/test_template.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,20 @@ class TestSqlTemplateConstruction:
208208
def test_plain_string(self):
209209
t = SqlTemplate("SELECT 1")
210210
assert t.strings == ("SELECT 1",)
211-
assert t.interpolations == []
211+
assert t.interpolations == ()
212212

213213
def test_multiple_strings_merged(self):
214214
t = SqlTemplate("SELECT ", "1")
215215
assert t.strings == ("SELECT 1",)
216-
assert t.interpolations == []
216+
assert t.interpolations == ()
217217

218-
def test_with_param(self):
218+
def test_bare_param_raises(self):
219219
p = Param(value=42, name="x")
220-
t = SqlTemplate("SELECT ", p, " FROM t")
221-
assert t.strings == ("SELECT ", " FROM t")
220+
with pytest.raises(TypeError, match="Unexpected part type"):
221+
SqlTemplate("SELECT ", p, " FROM t") # ty:ignore[invalid-argument-type]
222+
wrapped = ParamInterpolation(p)
223+
t = SqlTemplate("SELECT ", wrapped, " FROM t")
222224
assert len(t.interpolations) == 1
223-
assert t.interpolations[0].value is p
224225

225226
def test_with_interpolation(self):
226227
interp = FakeInterpolation(value=42, expression="x")
@@ -242,7 +243,7 @@ def test_no_args(self):
242243
"""Empty SqlTemplate should produce a single empty string."""
243244
t = SqlTemplate()
244245
assert t.strings == ("",)
245-
assert t.interpolations == []
246+
assert t.interpolations == ()
246247

247248

248249
# ═══════════════════════════════════════════════════════════════════════════════

0 commit comments

Comments
 (0)