From 10265b3fa2dbbd8f83e30b536c0f1a6232dd0366 Mon Sep 17 00:00:00 2001 From: Mauro Scomparin Date: Tue, 10 Jul 2018 21:48:51 +0200 Subject: [PATCH] fixed broken tests --- money/tests/test_money.py | 44 +++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/money/tests/test_money.py b/money/tests/test_money.py index 063de4d..a49bdf7 100644 --- a/money/tests/test_money.py +++ b/money/tests/test_money.py @@ -7,11 +7,12 @@ from money import money class MoneyTest(unittest.TestCase): - def test_passa_sempre(self): - self.assertTrue(True, msg='se fallisce son problemi') + def test_the_whole_univers(self): + self.assertTrue(True, msg='if this fails something is very wrong') def test_riassunto_last_movement_number(self): - self.assertEqual(money.last_movement_number_message(10), "latest 10 movements:") + self.assertEqual(money.last_movement_number_message( + 10), "latest 10 movements:") def test_config_file_name(self): self.assertEqual(money.CONFIG_FILE_NAME, 'money.conf') @@ -23,7 +24,7 @@ class MoneyTest(unittest.TestCase): def test_default_configuration(self): conf = money.default_configuration() self.assertTrue(money.DATA_FILE_NAME in conf) - self.assertEqual(conf[money.DATA_FILE_NAME], 'movimenti.dat') + self.assertEqual(conf[money.DATA_FILE_NAME], 'movements.dat') self.assertTrue(money.LAST_MOVEMENT_NUMBER in conf) self.assertEqual(conf[money.LAST_MOVEMENT_NUMBER], 5) @@ -33,7 +34,8 @@ class MoneyTest(unittest.TestCase): def test_override_default_configuration(self): def_conf = money.default_configuration() - new_conf = {money.DATA_FILE_NAME: 'new-file.dat', money.LAST_MOVEMENT_NUMBER : 10} + new_conf = {money.DATA_FILE_NAME: 'new-file.dat', + money.LAST_MOVEMENT_NUMBER: 10} res = money.override_default_configuration(def_conf, new_conf) self.assertTrue(money.DATA_FILE_NAME in res) self.assertEqual(res[money.DATA_FILE_NAME], 'new-file.dat') @@ -42,26 +44,10 @@ class MoneyTest(unittest.TestCase): def test_sort_movements(self): date = [ - { - 'data': '18/04/2017', - 'ora': '00:01', - 'prog': 1, - }, - { - 'data': '19/04/2017', - 'ora': '00:01', - 'prog': 2, - }, - { - 'data': '17/04/2017', - 'ora': '', - 'prog': 3, - }, - { - 'data': '', - 'ora': '00:01', - 'prog': 4, - }, + create_test_movement('18/04/2017', '00:01', 1), + create_test_movement('19/04/2017', '00:01', 2), + create_test_movement('17/04/2017', '', 3), + create_test_movement('', '00:01', 4), ] res = money.sort_movements(date) self.assertEqual(res[0]['prog'], 2) @@ -70,6 +56,14 @@ class MoneyTest(unittest.TestCase): self.assertEqual(res[3]['prog'], 4) +def create_test_movement(date, hour, prog): + return { + money.DATE_FIELD_NAME: date, + money.HOUR_FIELD_NAME: hour, + 'prog': prog, + } + + def main(): unittest.main() -- 2.25.1