Skip to content

Commit cf403b5

Browse files
authored
Merge pull request #613 from rwmehta/rwmehta/test-coverage-table-join
added tests for branching in tables _join
2 parents 0c82a19 + 572b08f commit cf403b5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_tables.py

+30
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,36 @@ def test_move_column(table):
16311631
table = table.move_column(2, 1)
16321632
assert table.labels == ('count', 'points', 'letter')
16331633

1634+
1635+
def test_join_with_empty_self(table2):
1636+
empty_table = Table().with_columns(['letter', []])
1637+
result = empty_table.join('letter', table2)
1638+
assert result is None, "Expected None when joining with an empty self table"
1639+
1640+
def test_join_with_empty_other(table):
1641+
empty_table = Table().with_columns(['points', []])
1642+
result = table.join('points', empty_table)
1643+
assert result is None, "Expected None when joining with an empty other table"
1644+
1645+
def test_join_with_other_label(table, table2):
1646+
result = table.join('points', table2, 'points')
1647+
assert_equal(result, """
1648+
points | letter | count | names
1649+
1 | a | 9 | one
1650+
2 | b | 3 | two
1651+
2 | c | 3 | two
1652+
""")
1653+
1654+
def test_join_without_other_label(table, table2):
1655+
result = table.join('points', table2)
1656+
assert_equal(result, """
1657+
points | letter | count | names
1658+
1 | a | 9 | one
1659+
2 | b | 3 | two
1660+
2 | c | 3 | two
1661+
""")
1662+
1663+
16341664
##################
16351665
# Export/Display #
16361666
##################

0 commit comments

Comments
 (0)