本文整理汇总了Python中money.Money.franc方法的典型用法代码示例。如果您正苦于以下问题:Python Money.franc方法的具体用法?Python Money.franc怎么用?Python Money.franc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类money.Money
的用法示例。
在下文中一共展示了Money.franc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMixedAddition
# 需要导入模块: from money import Money [as 别名]
# 或者: from money.Money import franc [as 别名]
def testMixedAddition(self):
fiveBucks = Money.dollar(5)
tenFrancs = Money.franc(10)
bank = Bank()
bank.addRate('CHF', 'USD', 2)
result = bank.reduce(fiveBucks.plus(tenFrancs), 'USD')
self.assertEquals(Money.dollar(10), result)
示例2: testSumTimes
# 需要导入模块: from money import Money [as 别名]
# 或者: from money.Money import franc [as 别名]
def testSumTimes(self):
fiveBucks = Money.dollar(5)
tenFrancs = Money.franc(10)
bank = Bank()
bank.addRate('CHF', 'USD', 2)
sum = Sum(fiveBucks, tenFrancs).times(2)
result = bank.reduce(sum, 'USD')
self.assertEquals(Money.dollar(20), result)
示例3: testCurrency
# 需要导入模块: from money import Money [as 别名]
# 或者: from money.Money import franc [as 别名]
def testCurrency(self):
self.assertEquals('USD', Money.dollar(1).currency)
self.assertEquals('CHF', Money.franc(1).currency)
示例4: testReduceMoneyDifferentCurrency
# 需要导入模块: from money import Money [as 别名]
# 或者: from money.Money import franc [as 别名]
def testReduceMoneyDifferentCurrency(self):
bank = Bank()
bank.addRate('CHF', 'USD', 2)
result = bank.reduce(Money.franc(2), 'USD')
self.assertEquals(Money.dollar(1), result)
示例5: testEquality
# 需要导入模块: from money import Money [as 别名]
# 或者: from money.Money import franc [as 别名]
def testEquality(self):
self.assertTrue(Money.dollar(5) == Money.dollar(5))
self.assertFalse(Money.dollar(5) == Money.dollar(6))
self.assertFalse(Money.franc(5) == Money.dollar(5))