-
Notifications
You must be signed in to change notification settings - Fork 6
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
Issue #145 #146
Issue #145 #146
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import datetime | ||
import warnings | ||
from pdtable.io.parsers.blocks import _get_destinations_safely_stripped | ||
|
||
|
||
class TestGetDestinationsSafelyStripped: | ||
def test_string_input(self) -> None: | ||
assert _get_destinations_safely_stripped(" hello ") == "hello" | ||
|
||
def test_int_input(self) -> None: | ||
assert _get_destinations_safely_stripped(123) == "123" | ||
|
||
def test_string_input_with_leading_trailing_spaces(self) -> None: | ||
assert _get_destinations_safely_stripped(" hello world ") == "hello world" | ||
|
||
def test_int_input_with_leading_trailing_spaces(self) -> None: | ||
assert _get_destinations_safely_stripped(" 123 ") == "123" | ||
|
||
def test_datetime_input(self) -> None: | ||
datetime_now = datetime.datetime.now() | ||
|
||
with warnings.catch_warnings(record=True) as w: | ||
destinations = _get_destinations_safely_stripped(datetime_now) | ||
assert len(w) == 1 | ||
assert destinations.replace(' ', '') == destinations |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pandas<2.0 | ||
numpy | ||
numpy<2.0 | ||
typing-extensions | ||
|
||
# OPTIONAL | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
pandas>=2.0 | ||
pyarrow | ||
numpy | ||
numpy<2.0 # numpy 2 does not work for pint library on python3.9 | ||
typing-extensions | ||
pyarrow | ||
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. I wonder why we did not need 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. I just have changed the order to have the same as we have in the |
||
|
||
# OPTIONAL | ||
openpyxl | ||
|
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.
I wonder if at this point
input_data
is not already astr
with white space replaced by underscore? This would make the warning a little confusing.I would suggest to not reassign
input_data
but rather create a new variableresult
(or whatever name you prefer) to be able to report on the original data.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.
yeap, nice catch, thanks:)