forked from piccolo-orm/piccolo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_repr.py
More file actions
31 lines (25 loc) · 892 Bytes
/
test_repr.py
File metadata and controls
31 lines (25 loc) · 892 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
from tests.example_apps.music.tables import Manager
from ..base import DBTestCase, postgres_only, sqlite_only
class TestTableRepr(DBTestCase):
@postgres_only
def test_repr_postgres(self):
self.assertEqual(
Manager().__repr__(),
'<Manager: "id" SERIAL PRIMARY KEY NOT NULL>',
)
self.insert_row()
manager = Manager.objects().first().run_sync()
self.assertEqual(
manager.__repr__(), f"<Manager: {Manager._meta.primary_key}>"
)
@sqlite_only
def test_repr_sqlite(self):
self.assertEqual(
Manager().__repr__(),
'<Manager: "id" INTEGER PRIMARY KEY NOT NULL>',
)
self.insert_row()
manager = Manager.objects().first().run_sync()
self.assertEqual(
manager.__repr__(), f"<Manager: {Manager._meta.primary_key}>"
)