forked from piccolo-orm/piccolo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_str.py
More file actions
27 lines (22 loc) · 920 Bytes
/
test_str.py
File metadata and controls
27 lines (22 loc) · 920 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 unittest import TestCase
from ..example_app.tables import Manager
class TestTableStr(TestCase):
def test_str(self):
self.assertEqual(
Manager._table_str(),
(
"class Manager(Table, tablename='manager'):\n"
" id = PrimaryKey(null=False, primary=True, key=True, unique=False, index=False, index_method=IndexMethod.btree)\n" # noqa
" name = Varchar(length=50, default='', null=False, primary=False, key=False, unique=False, index=False, index_method=IndexMethod.btree)\n" # noqa
),
)
self.assertEqual(
Manager._table_str(abbreviated=True),
(
"class Manager(Table):\n"
" id = PrimaryKey()\n"
" name = Varchar()\n"
),
)
# We should also be able to print it directly.
print(Manager)