Skip to content

Commit

Permalink
Merge pull request #613 from rwmehta/rwmehta/test-coverage-table-join
Browse files Browse the repository at this point in the history
added tests for branching in tables _join
  • Loading branch information
davidwagner authored Jun 4, 2024
2 parents 0c82a19 + 572b08f commit cf403b5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,36 @@ def test_move_column(table):
table = table.move_column(2, 1)
assert table.labels == ('count', 'points', 'letter')


def test_join_with_empty_self(table2):
empty_table = Table().with_columns(['letter', []])
result = empty_table.join('letter', table2)
assert result is None, "Expected None when joining with an empty self table"

def test_join_with_empty_other(table):
empty_table = Table().with_columns(['points', []])
result = table.join('points', empty_table)
assert result is None, "Expected None when joining with an empty other table"

def test_join_with_other_label(table, table2):
result = table.join('points', table2, 'points')
assert_equal(result, """
points | letter | count | names
1 | a | 9 | one
2 | b | 3 | two
2 | c | 3 | two
""")

def test_join_without_other_label(table, table2):
result = table.join('points', table2)
assert_equal(result, """
points | letter | count | names
1 | a | 9 | one
2 | b | 3 | two
2 | c | 3 | two
""")


##################
# Export/Display #
##################
Expand Down

0 comments on commit cf403b5

Please sign in to comment.