-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1509 from nextstrain/format-dates-mask-empty
augur curate format-dates: mask empty fields
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/functional/curate/cram/format-dates/date-field-not-found-error.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Setup | ||
|
||
$ export AUGUR="${AUGUR:-$TESTDIR/../../../../../bin/augur}" | ||
|
||
Providing a date field that does not exist in the record should result in an error. | ||
|
||
$ echo '{"record": 1, "date": "2024-01-01"}' \ | ||
> | ${AUGUR} curate format-dates \ | ||
> --date-fields "bad-date-field" | ||
ERROR: Expected date field 'bad-date-field' not found in record 0. | ||
[2] |
17 changes: 17 additions & 0 deletions
17
tests/functional/curate/cram/format-dates/empty-date-field.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Setup | ||
|
||
$ export AUGUR="${AUGUR:-$TESTDIR/../../../../../bin/augur}" | ||
|
||
Test empty date value, which should be returned as a fully masked date. | ||
|
||
$ echo '{"record": 1, "date": ""}' \ | ||
> | ${AUGUR} curate format-dates \ | ||
> --date-fields "date" | ||
{"record": 1, "date": "XXXX-XX-XX"} | ||
|
||
Test whitespace only date value, which should be returned as a fully masked date. | ||
|
||
$ echo '{"record": 1, "date": " "}' \ | ||
> | ${AUGUR} curate format-dates \ | ||
> --date-fields "date" | ||
{"record": 1, "date": "XXXX-XX-XX"} |