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

Fix tests relative referentials

parent da1963da
Branches
Tags
No related merge requests found
......@@ -64,7 +64,7 @@ class TestRelative(unittest.TestCase, QuamashTest):
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_localized_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -72,7 +72,7 @@ class TestRelative(unittest.TestCase, QuamashTest):
referential = Relative(1011, community, app, None)
async def exec_test():
value = await referential.localized(units=True, international_system=True)
self.assertEqual(value, "1.011000 dUD TC")
self.assertEqual(value, "1.011000 mUD TC")
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -92,7 +92,7 @@ class TestRelative(unittest.TestCase, QuamashTest):
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_localized_no_units_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -100,7 +100,7 @@ class TestRelative(unittest.TestCase, QuamashTest):
referential = Relative(1011, community, app, None)
async def exec_test():
value = await referential.localized(units=False, international_system=True)
self.assertEqual(value, "1.011000 dUD ")
self.assertEqual(value, "1.011000 mUD ")
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -120,7 +120,7 @@ class TestRelative(unittest.TestCase, QuamashTest):
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_diff_localized_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -128,13 +128,13 @@ class TestRelative(unittest.TestCase, QuamashTest):
referential = Relative(1011, community, app, None)
async def exec_test():
value = await referential.diff_localized(units=True, international_system=True)
self.assertEqual(value, "1.011000 dUD TC")
self.assertEqual(value, "1.011000 mUD TC")
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_diff_localized_no_units_no_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -142,13 +142,13 @@ class TestRelative(unittest.TestCase, QuamashTest):
referential = Relative(1011, community, app, None)
async def exec_test():
value = await referential.diff_localized(units=False, international_system=False)
self.assertEqual(value, "0.101100")
self.assertEqual(value, "0.001011")
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_diff_localized_no_units_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -156,5 +156,5 @@ class TestRelative(unittest.TestCase, QuamashTest):
referential = Relative(1011, community, app, None)
async def exec_test():
value = await referential.diff_localized(units=False, international_system=True)
self.assertEqual(value, "1.011000 dUD ")
self.assertEqual(value, "1.011000 mUD ")
self.lp.run_until_complete(exec_test())
\ No newline at end of file
......@@ -69,7 +69,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_localized_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
......@@ -78,7 +78,7 @@ 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({0}) TC".format(QLocale.toString(
self.assertEqual(value, "1.011000 mUD({0}) TC".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
......@@ -103,7 +103,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_localized_no_units_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
......@@ -112,7 +112,7 @@ 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({0}) ".format(QLocale.toString(
self.assertEqual(value, "1.011000 mUD({0}) ".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
......@@ -141,7 +141,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_diff_localized_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
......@@ -150,7 +150,7 @@ 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({0}) TC".format(QLocale.toString(
self.assertEqual(value, "1.011000 mUD({0}) TC".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
......@@ -175,7 +175,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Community')
@patch('sakia.core.Application')
def test_diff_localized_no_units_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
......@@ -184,7 +184,7 @@ 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({0}) ".format(QLocale.toString(
self.assertEqual(value, "1.011000 mUD({0}) ".format(QLocale.toString(
QLocale(),
QDateTime.fromTime_t(1452663088792).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
......
......@@ -81,7 +81,7 @@ class TestRelativeZSum(unittest.TestCase, QuamashTest):
referential = RelativeZSum(110, community, app, None)
async def exec_test():
value = await referential.localized(units=True, international_system=True)
self.assertEqual(value, "1.000000 dR0 TC")
self.assertEqual(value, "100.000000 mR0 TC")
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -115,7 +115,7 @@ class TestRelativeZSum(unittest.TestCase, QuamashTest):
referential = RelativeZSum(110, community, app, None)
async def exec_test():
value = await referential.localized(units=False, international_system=True)
self.assertEqual(value, "1.000000 dR0 ")
self.assertEqual(value, "100.000000 mR0 ")
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -146,7 +146,7 @@ class TestRelativeZSum(unittest.TestCase, QuamashTest):
referential = RelativeZSum(90, community, app, None)
async def exec_test():
value = await referential.diff_localized(units=True, international_system=True)
self.assertEqual(value, "9.000000 dR0 TC")
self.assertEqual(value, "900.000000 mR0 TC")
self.lp.run_until_complete(exec_test())
@patch('sakia.core.Community')
......@@ -180,5 +180,5 @@ class TestRelativeZSum(unittest.TestCase, QuamashTest):
referential = RelativeZSum(90, community, app, None)
async def exec_test():
value = await referential.diff_localized(units=False, international_system=True)
self.assertEqual(value, "9.000000 dR0 ")
self.assertEqual(value, "900.000000 mR0 ")
self.lp.run_until_complete(exec_test())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment