summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStephen Rosen <sirosen@globus.org>2018-08-27 22:16:12 +0000
committerDavid Lord <davidism@gmail.com>2018-09-13 07:37:35 -0700
commit5fe0b7e7795f9bb04ae926d00868cfeb1fa33187 (patch)
tree826f5f33f3c4d156f85517ccb0f345e9e4372040 /tests
parent6e62332349db6e93decf47666c4cd6fe20df6b02 (diff)
downloadclick-5fe0b7e7795f9bb04ae926d00868cfeb1fa33187.tar.gz
Add documentation for DateTime param type
Add a docstring which defines the behaviors of the class, including default formats supported, usage of ``datetime.strptime`` and "first successful parse wins" behavior. Also add '%Y-%m-%d %H:%M:%S' to the default formats, as it is at least as commonly seen as '%Y-%m-%dT%H:%M:%S'. Minor test fix to handle the new format. Add ``click.DateTime`` to changelog.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_basic.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test_basic.py b/tests/test_basic.py
index 414fd1c..8de6301 100644
--- a/tests/test_basic.py
+++ b/tests/test_basic.py
@@ -349,11 +349,13 @@ def test_datetime_option_default(runner):
result = runner.invoke(cli, ['--start_date=2015-09'])
assert result.exit_code == 2
- assert 'Invalid value for "--start_date": invalid datetime format: 2015-09. ' \
- '(choose from %Y-%m-%d, %Y-%m-%dT%H:%M:%S)' in result.output
+ assert ('Invalid value for "--start_date": '
+ 'invalid datetime format: 2015-09. '
+ '(choose from %Y-%m-%d, %Y-%m-%dT%H:%M:%S, %Y-%m-%d %H:%M:%S)'
+ ) in result.output
result = runner.invoke(cli, ['--help'])
- assert '--start_date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S]' in result.output
+ assert '--start_date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]' in result.output
def test_datetime_option_custom(runner):