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

4360 cl search bug fix #4545

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion codalab/model/bundle_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def add_join(table: Table, condition: Any, left_outer_join: bool = False):
conjunct = condition
elif key in ('.before', '.after'):
try:
target_datetime = parser.isoparse(value)
target_datetime = parser.parse(value)
except ValueError:
raise UsageError(
"Unable to parse datetime. Datetime must be specified as an ISO-8601 datetime string such as YYYY-MM-DD."
Expand Down
6 changes: 6 additions & 0 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,12 @@ def test_search_time(ctx):
time.sleep(1)
time3 = datetime.now().isoformat()

# Check date format works correctly, GH issue #4360
check_not_equals(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is oddly specific - can we test for what the output should be?

'UsageError: Unable to parse datetime. Datetime must be specified as an ISO-8601 datetime string such as YYYY-MM-DD.',
_run_command([cl, 'search', '.before=2023-1-11', '.count']),
)

# No results
check_equals('', _run_command([cl, 'search', 'name=' + name, '.before=' + time1, '-u']))
check_equals('', _run_command([cl, 'search', 'name=' + name, '.after=' + time3, '-u']))
Expand Down