summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2020-11-12 14:19:17 +0000
committerGitHub <noreply@github.com>2020-11-12 15:19:17 +0100
commit0cbccaebebf671332669a4e54a5fa0ede062fdd9 (patch)
tree2c84155664683b8c4b8966654f0a9970840be62b /tests
parent895f6e49925ed0ae4bb96dc4d3af17fdc9c4846e (diff)
Simplified TimeFormat.g().
Diffstat (limited to 'tests')
-rw-r--r--tests/utils_tests/test_dateformat.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/utils_tests/test_dateformat.py b/tests/utils_tests/test_dateformat.py
index 5eb166e2bd..c6d3ded80f 100644
--- a/tests/utils_tests/test_dateformat.py
+++ b/tests/utils_tests/test_dateformat.py
@@ -178,3 +178,19 @@ class DateFormatTests(SimpleTestCase):
dateformat.format(datetime(year, 9, 8, 5, 0), 'y'),
expected_date,
)
+
+ def test_twelve_hour_format(self):
+ tests = [
+ (0, '12'),
+ (1, '1'),
+ (11, '11'),
+ (12, '12'),
+ (13, '1'),
+ (23, '11'),
+ ]
+ for hour, expected in tests:
+ with self.subTest(hour=hour):
+ self.assertEqual(
+ dateformat.format(datetime(2000, 1, 1, hour), 'g'),
+ expected,
+ )