MCPcopy Index your code
hub / github.com/Vanderhoof/PyDBML / test_inline_refs_schema

Method test_inline_refs_schema

test/test_parser.py:50–69  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 self.assertEqual(r[4].col2[0].name, 'id')
49
50 def test_inline_refs_schema(self) -> None:
51 # Thanks @jens-koster for this example
52 source = '''
53Table core.pk_tbl {
54 pk_col varchar [pk]
55}
56Table core.fk_tbl {
57 fk_col varchar [ref: > core.pk_tbl.pk_col]
58}
59'''
60 p = PyDBMLParser(source)
61 p.parse()
62 r = p.refs
63 pk_tbl = p.tables[0]
64 fk_tble = p.tables[1]
65 ref = p.refs[0]
66 self.assertEqual(ref.table1, fk_tble.name)
67 self.assertEqual(ref.table2, pk_tbl.name)
68 self.assertEqual(ref.schema1, fk_tble.schema)
69 self.assertEqual(ref.schema2, pk_tbl.schema)
70
71
72class TestRefs(TestCase):

Callers

nothing calls this directly

Calls 2

parseMethod · 0.95
PyDBMLParserClass · 0.90

Tested by

no test coverage detected