forked from piccolo-orm/piccolo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_slots.py
More file actions
44 lines (40 loc) · 983 Bytes
/
test_slots.py
File metadata and controls
44 lines (40 loc) · 983 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from unittest import TestCase
from piccolo.query.methods import (
Alter,
Count,
Create,
Delete,
Exists,
Insert,
Objects,
Raw,
Select,
TableExists,
Update,
)
from ..example_app.tables import Manager
class TestSlots(TestCase):
def test_attributes(self):
"""
Make sure slots are working correctly - they improve performance,
and help prevent subtle bugs.
"""
for query_class in (
Alter,
Count,
Create,
Delete,
Exists,
Insert,
Objects,
Raw,
Select,
TableExists,
Update,
):
class_name = query_class.__name__
with self.assertRaises(
AttributeError, msg=f"{class_name} didn't raised an error"
):
print(f"Setting {class_name} attribute")
query_class(table=Manager).abc = 123