Skip to content

Commit

Permalink
add explicit test for .columns getter
Browse files Browse the repository at this point in the history
  • Loading branch information
icyveins7 committed Apr 12, 2024
1 parent 1799fd1 commit ecd2e96
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sew/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def cols(self):
@property
def columns(self):
'''
Dictionary of ColumnProxy objects based on the table columns.
Container of ColumnProxy objects based on the table columns.
'''
return self._cols

Expand Down
21 changes: 21 additions & 0 deletions tests/correctness.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,28 @@ def setUp(self):
)
# self.d.reloadTables()

def test_column_getter(self):
self.assertEqual(
self.d['correctness'].columnNames,
["col1", "col2", "col3"]
)
columns = self.d['correctness'].columns
self.assertEqual(
columns,
self.d['correctness'].cols
)

# Check each object's parameters
for i in range(3):
self.assertEqual(columns[i].typehint, float)
self.assertEqual(columns[i].tablename, 'correctness')

self.assertEqual(columns[0].name, 'col1')
self.assertEqual(columns[1].name, 'col2')
self.assertEqual(columns[2].name, 'col3')

# %%

def test_create_table_insert_drop(self):
fmtspec = sew.FormatSpecifier()
fmtspec.addColumn('c1', int)
Expand Down

0 comments on commit ecd2e96

Please sign in to comment.