Skip to content
Snippets Groups Projects
Commit ccd75c00 authored by inso's avatar inso
Browse files

Fix tests relative to past

parent 01465a37
No related branches found
No related tags found
No related merge requests found
import unittest
from asynctest.mock import Mock, CoroutineMock, patch, PropertyMock
from PyQt5.QtCore import QLocale
from PyQt5.QtCore import QLocale, QDateTime
from sakia.tests import QuamashTest
from sakia.core.money import RelativeToPast
......@@ -74,7 +74,11 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
referential = RelativeToPast(1011, community, app, 100)
async def exec_test():
value = await referential.localized(units=True, international_system=True)
self.assertEqual(value, "1.011000 dUD(21/07/2000 03:25) TC")
self.assertEqual(value, "1.011000 dUD({0}) TC".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792),
QLocale.dateTimeFormat(QLocale(), QLocale.ShortFormat)
)))
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -104,7 +108,11 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
referential = RelativeToPast(1011, community, app, 100)
async def exec_test():
value = await referential.localized(units=False, international_system=True)
self.assertEqual(value, "1.011000 dUD(21/07/2000 03:25) ")
self.assertEqual(value, "1.011000 dUD({0}) ".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792),
QLocale.dateTimeFormat(QLocale(), QLocale.ShortFormat)
)))
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -119,7 +127,11 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
referential = RelativeToPast(1011, community, app, 100)
async def exec_test():
value = await referential.diff_localized(units=True)
self.assertEqual(value, "0.101100 UD(21/07/2000 03:25) TC")
self.assertEqual(value, "0.101100 UD({0}) TC".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792),
QLocale.dateTimeFormat(QLocale(), QLocale.ShortFormat)
)))
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -134,7 +146,11 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
referential = RelativeToPast(1011, community, app, 100)
async def exec_test():
value = await referential.diff_localized(units=True, international_system=True)
self.assertEqual(value, "1.011000 dUD(21/07/2000 03:25) TC")
self.assertEqual(value, "1.011000 dUD({0}) TC".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792),
QLocale.dateTimeFormat(QLocale(), QLocale.ShortFormat)
)))
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -164,5 +180,9 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
referential = RelativeToPast(1011, community, app, 100)
async def exec_test():
value = await referential.diff_localized(units=False, international_system=True)
self.assertEqual(value, "1.011000 dUD(21/07/2000 03:25) ")
self.assertEqual(value, "1.011000 dUD({0}) ".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792),
QLocale.dateTimeFormat(QLocale(), QLocale.ShortFormat)
)))
self.lp.run_until_complete(exec_test())
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment