Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added tests for branching in tables _join #613

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading