Update.
This commit is contained in:
parent
695efe6d2f
commit
1a7cc682f6
13
ads.py
13
ads.py
@ -143,7 +143,7 @@ class AsyncDataSetConnector:
|
||||
"deleted_at": None,
|
||||
**args,
|
||||
}
|
||||
cols = "`" + "`, `".join(record) + "`"
|
||||
cols = "`" + "`, `".join(record) + "`"
|
||||
qs = ", ".join(["?"] * len(record))
|
||||
sql = f"INSERT INTO {table} ({cols}) VALUES ({qs})"
|
||||
await self._safe_execute(table, sql, list(record.values()), record)
|
||||
@ -249,9 +249,6 @@ class AsyncDataSetConnector:
|
||||
return default
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class TestAsyncDataSetConnector(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
async def asyncSetUp(self):
|
||||
@ -321,15 +318,15 @@ class TestAsyncDataSetConnector(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_inject(self):
|
||||
await self.connector.insert("people", {"name": "John Doe", "index": 30})
|
||||
await self.connector.insert("people", {"name": "Alice", "index": 23})
|
||||
await self.connector.delete("people", {"name": "John Doe","index": 30})
|
||||
await self.connector.delete("people", {"name": "John Doe", "index": 30})
|
||||
self.assertIsNone(await self.connector.get("people", {"name": "John Doe"}))
|
||||
count = await self.connector.count("people")
|
||||
self.assertEqual(count, 1)
|
||||
|
||||
|
||||
async def test_insert_binary(self):
|
||||
await self.connector.insert("binaries",{"data":b"1234"})
|
||||
print(await self.connector.get("binaries",{"data":b"1234"}))
|
||||
await self.connector.insert("binaries", {"data": b"1234"})
|
||||
print(await self.connector.get("binaries", {"data": b"1234"}))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user