-
Notifications
You must be signed in to change notification settings - Fork 303
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
Add two unit tests for join method #615
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ def test_setup_map(): | |
'width': 960, | ||
'height': 500, | ||
'features': [], | ||
'attr':'Map tiles by Stamen Design, CC BY 3.0 - Map data © OpenStreetMap' | ||
} | ||
""" Tests features as NumPy array. """ | ||
kwargs2 = { | ||
|
@@ -56,6 +57,7 @@ def test_setup_map(): | |
ds.Marker(51.514, -0.139), | ||
ds.Marker(51.519, -0.132) | ||
]), | ||
'attr':'Map tiles by Stamen Design, CC BY 3.0 - Map data © OpenStreetMap' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed, please remove |
||
} | ||
ds.Map(**kwargs1).show() | ||
ds.Map(**kwargs2).show() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,11 @@ def scrabble_table2(): | |
'pointsplus1', [2, 3, 3, 11], | ||
]) | ||
|
||
@pytest.fixture(scope='function') | ||
def empty_table(): | ||
"""Setup empty table""" | ||
return Table().with_columns("A",[]) | ||
|
||
|
||
def assert_equal(string1, string2): | ||
string1, string2 = str(string1), str(string2) | ||
|
@@ -1660,6 +1665,21 @@ def test_join_without_other_label(table, table2): | |
2 | c | 3 | two | ||
""") | ||
|
||
def test_join_with_empty_table(table, empty_table): | ||
result = empty_table._join('points', table) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I think you're testing the right things - testing the internal methods (denoted with the underscore at the beginning) is not a standard practice. I think this could be a good PR if you did these same tests using the "join" method. |
||
assert result is None | ||
|
||
result = table._join('points', empty_table) | ||
assert result is None | ||
|
||
def test_join_without_other_label(table, table2): | ||
result = table._join('points', table2) | ||
assert result is not None | ||
|
||
|
||
|
||
|
||
|
||
|
||
################## | ||
# Export/Display # | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, please remove