Skip to content

Commit 541abb1

Browse files
committed
merged test_meta and test_metaclass
1 parent 71a6190 commit 541abb1

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

tests/table/test_meta.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/table/test_metaclass.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
from unittest import TestCase
22

3+
from piccolo.table import Table
4+
35
from ..example_app.tables import Band
46

57

68
class TestMetaClass(TestCase):
79
def test_tablename(self):
810
self.assertEqual(Band._meta.tablename, "band")
911

12+
def test_protected_table_names(self):
13+
"""
14+
Some tablenames are forbidden because they're reserved words in the
15+
database, and can potentially cause issues.
16+
"""
17+
with self.assertRaises(ValueError):
18+
19+
class User(Table):
20+
pass
21+
22+
with self.assertRaises(ValueError):
23+
24+
class MyUser(Table, tablename="user"):
25+
pass

0 commit comments

Comments
 (0)