Skip to content

Commit 8717257

Browse files
authored
Merge pull request #671 from MossIV/table_split_test
Implemented code coverage test case for table.split function
2 parents f7a8813 + 13a1165 commit 8717257

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/test_tables.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,6 +1996,20 @@ def test_num_columns(table):
19961996
number = table.num_columns
19971997
assert number == 3
19981998

1999+
def test_split(table):
2000+
"""Test that split copies over the _formats variable from the original table to the new tables correctly after splitting"""
2001+
2002+
#defined a custom formatter for points column
2003+
def positive_point_formatter(value):
2004+
return f"+{value}"
2005+
2006+
table.set_format("points", positive_point_formatter)
2007+
2008+
t1, t2 = table.split(2)
2009+
2010+
assert t1._formats == table._formats
2011+
assert t2._formats == table._formats
2012+
19992013
def test_with_columns(table):
20002014
"""Test that with_columns returns self if no labels_and_values passed"""
20012015
t = table.with_columns()

0 commit comments

Comments
 (0)