forked from piccolo-orm/piccolo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_raw.py
More file actions
27 lines (20 loc) · 735 Bytes
/
test_raw.py
File metadata and controls
27 lines (20 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from ..base import DBTestCase
from ..example_app.tables import Band
class TestRaw(DBTestCase):
def test_raw_without_args(self):
self.insert_row()
response = Band.raw("select * from band").run_sync()
self.assertDictEqual(
response[0],
{"id": 1, "name": "Pythonistas", "manager": 1, "popularity": 1000},
)
def test_raw_with_args(self):
self.insert_rows()
response = Band.raw(
"select * from band where name = {}", "Pythonistas"
).run_sync()
self.assertTrue(len(response) == 1)
self.assertDictEqual(
response[0],
{"id": 1, "name": "Pythonistas", "manager": 1, "popularity": 1000},
)