Ejemplo n.º 1
0
 def tearDown(self):
     testbase.resetLocale()
Ejemplo n.º 2
0
 def tearDown(self):
     testbase.resetLocale()
Ejemplo n.º 3
0
            # The test is that none of these calls throw an exception including the unicode conversion.
            for curr in currencies.CurrencyList:
                unicode(curr().float2str(1000))

# Automatically generate some tests for locales.
localeDisplays = {}
for loc in testbase.LOCALES:
    assertLocale(loc)
    localeDisplays[loc] = currencies.LocalizedCurrency().float2str(LocaleTests.TEST_AMOUNT)

for loc in testbase.LOCALES:
    assertLocale(loc)
    localecurr = currencies.LocalizedCurrency()
    locales = [
        currencies.UnitedStatesCurrency,
        currencies.RussianCurrency,
        currencies.EuroCurrency,
        ]

    for i, desiredloc in enumerate(testbase.LOCALES):
        desiredcurr = locales[i]()
        def test(self, localecurr=localecurr, desiredcurr=desiredcurr, desiredloc=desiredloc):
            self.assertEqual(localeDisplays[desiredloc], desiredcurr.float2str(LocaleTests.TEST_AMOUNT))
        testName = ("test%sDisplays%sProperly"%(localecurr.GetCurrencyNick(), desiredcurr.GetCurrencyNick())).replace(" ", "")
        setattr(LocaleTests, testName, test)

testbase.resetLocale()

if __name__ == "__main__":
    unittest.main()