return 'latest {} movements:'.format(n)
-def actual_value_message(value):
- return 'actual value: {}'.format(str(value))
+def value_message(str, value):
+ return str.format(value)
def write_latest_movements(data_file, conf):
total_incomes = total_incomes + movement_value
else:
total_expenses = total_expenses + movement_value
- print(actual_value_message(actual_value))
- print('total incomes:', str(total_incomes))
- print('total expenses:', str(total_expenses))
+ print(value_message('actual value: {}', actual_value))
+ print(value_message('total incomes: {}', total_incomes))
+ print(value_message('total expenses: {}', total_expenses))
print(last_movement_number_message(conf[LAST_MOVEMENT_NUMBER]))
for i in range(conf[LAST_MOVEMENT_NUMBER]):
if i < len(ordered_movements):
self.assertEqual(money.last_movement_number_message(
10), "latest 10 movements:")
- def test_actual_value_message(self):
- self.assertEqual(money.actual_value_message(
- Decimal(10.00)), "actual value: 10")
+ def test_value_message(self):
+ self.assertEqual(money.value_message('blah: {}',
+ Decimal(10.00)), "blah: 10")
def test_config_file_name(self):
self.assertEqual(money.CONFIG_FILE_NAME, 'money.conf')