Renamed db.escape() to db.quote() and documented it

Closes #217
This commit is contained in:
Simon Willison 2021-01-02 20:15:04 -08:00
commit 3d041d34d5
4 changed files with 38 additions and 7 deletions

View file

@ -922,3 +922,10 @@ def test_create_with_nested_bytes(fresh_db):
record = {"id": 1, "data": {"foo": b"bytes"}}
fresh_db["t"].insert(record)
assert [{"id": 1, "data": '{"foo": "b\'bytes\'"}'}] == list(fresh_db["t"].rows)
@pytest.mark.parametrize(
"input,expected", [("hello", "'hello'"), ("hello'there'", "'hello''there'''")]
)
def test_quote(fresh_db, input, expected):
assert fresh_db.quote(input) == expected