From b293d6ad88559db08f249d58e72bfab78277dd83 Mon Sep 17 00:00:00 2001
From: Peter Kessen
Date: Fri, 25 Sep 2015 17:41:12 +0200
Subject: [PATCH] added test for human_seconds
---
test/test_ui_commands.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/test/test_ui_commands.py b/test/test_ui_commands.py
index 08f44eb57..e9616ca6f 100644
--- a/test/test_ui_commands.py
+++ b/test/test_ui_commands.py
@@ -84,6 +84,32 @@ class QueryTest(_common.TestCase):
self.check_do_query(0, 2, album=True, also_items=False)
+class InitTest(_common.LibTestCase):
+ def setUp(self):
+ super(InitTest, self).setUp()
+
+ self.io.install()
+
+ def tearDown(self):
+ self.io.restore()
+
+ def test_human_seconds(self):
+ tests = [
+ (0, '0.0 seconds'),
+ (30, '30.0 seconds'),
+ (60, '1.0 minutes'),
+ (90, '1.5 minutes'),
+ (125, '2.1 minutes'),
+ (3600, '1.0 hours'),
+ (86400, '1.0 days'),
+ (604800, '1.0 weeks'),
+ (31449600, '1.0 years'),
+ (314496000, '1.0 decades'),
+ ]
+ for i, h in tests:
+ self.assertEqual(h, ui.human_seconds(i))
+
+
def suite():
return unittest.TestLoader().loadTestsFromName(__name__)