From aaa7ed528a47d92c1ed9a1793a6bbde9db07cf5d Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Fri, 21 Feb 2020 00:35:18 +0100 Subject: Support parsing date refs --- _pytest/test_unfurl.py | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to '_pytest') diff --git a/_pytest/test_unfurl.py b/_pytest/test_unfurl.py index 9523bc6..3545332 100644 --- a/_pytest/test_unfurl.py +++ b/_pytest/test_unfurl.py @@ -1,7 +1,8 @@ from __future__ import print_function, unicode_literals -import wee_slack +from datetime import datetime, timedelta import pytest +import wee_slack @pytest.mark.parametrize('case', ( @@ -103,8 +104,35 @@ import pytest 'output': "@othersubteam This is announcement for the dev team" }, { - 'input': "Ends .", - 'output': "Ends Mar 18, 2020 at 23:19 PM." + 'input': "Ends .", + 'output': "Ends 2020-03-19 - March 19, 2020 - Mar 19, 2020 - Thursday, March 19, 2020 at 00:19 - 00:19:28." + }, + { + 'input': "Ends .", + 'output': "Ends 2020-03-19 {invalid_token}." + }, + { + 'input': "Ends .", + 'output': "Ends 2020-03-19 (http://github.com)." + }, + { + 'input': "Ends .".format( + int((datetime.today()).timestamp())), + 'output': "Ends today - today - today." + }, + { + 'input': "Ends .".format( + int((datetime.today() - timedelta(days=1)).timestamp())), + 'output': "Ends yesterday - yesterday - yesterday." + }, + { + 'input': "Ends .".format( + int((datetime.today() + timedelta(days=1)).timestamp())), + 'output': "Ends tomorrow - tomorrow - tomorrow." + }, + { + 'input': "Ends .", + 'output': "Ends January 01, 2020 - Jan 01, 2020 - Wednesday, January 01, 2020." } )) def test_unfurl_refs(case, realish_eventrouter): -- cgit