-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add matchers for ISO 8601 date format
This introduces pact.Format.iso_8601_datetime() method to match a string for a full ISO 8601 Date. This method differs does not do any sort of date validation, only checks if the string is according to the ISO 8601 spec. This method differs from `pact.Format.timestamp`, `pact.Format.date` and `pact.Format.time` implementations in that it is more stringent and tests the string for exact match to the ISO 8601 dates format. Without `with_millis` parameter will match string containing ISO 8601 formatted dates as stated bellow: * 2016-12-15T20:16:01 * 2010-05-01T01:14:31.876 * 2016-05-24T15:54:14.00000Z * 1994-11-05T08:15:30-05:00 * 2002-01-31T23:00:00.1234-02:00 * 1991-02-20T06:35:26.079043+00:00 Otherwise, ONLY dates with milliseconds will match the pattern: * 2010-05-01T01:14:31.876 * 2016-05-24T15:54:14.00000Z * 2002-01-31T23:00:00.1234-02:00 * 1991-02-20T06:35:26.079043+00:00 This change aims to bring the capabilities of the python library into alignment with pact-foundation/docs.pact.io#88, since the existing functionality is a bit liberal and allows tests to pass even in cases where the dates do not conform to the ISO 8601 spec.
- Loading branch information
1 parent
48b7f37
commit 8b38b93
Showing
3 changed files
with
109 additions
and
13 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
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