MCPcopy Create free account
hub / github.com/Vanderhoof/PyDBML / test_getitem

Method test_getitem

test/test_classes/test_table.py:24–39  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22 self.assertEqual(t2.schema, 'schema1')
23
24 def test_getitem(self) -> None:
25 t = Table('products')
26 c1 = Column('col1', 'integer')
27 c2 = Column('col2', 'integer')
28 c3 = Column('col3', 'integer')
29 t.add_column(c1)
30 t.add_column(c2)
31 t.add_column(c3)
32 self.assertIs(t['col1'], c1)
33 self.assertIs(t[1], c2)
34 with self.assertRaises(IndexError):
35 t[22]
36 with self.assertRaises(TypeError):
37 t[None]
38 with self.assertRaises(ColumnNotFoundError):
39 t['wrong']
40
41 def test_init_with_columns(self) -> None:
42 t = Table(

Callers

nothing calls this directly

Calls 3

add_columnMethod · 0.95
TableClass · 0.90
ColumnClass · 0.90

Tested by

no test coverage detected