當前位置: 首頁>>代碼示例>>Python>>正文


Python Money.dollar方法代碼示例

本文整理匯總了Python中money.Money.dollar方法的典型用法代碼示例。如果您正苦於以下問題:Python Money.dollar方法的具體用法?Python Money.dollar怎麽用?Python Money.dollar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在money.Money的用法示例。


在下文中一共展示了Money.dollar方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_less_equal_with_two_different_nationality_money

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
    def test_less_equal_with_two_different_nationality_money(self):
        greatest = Money.dollar(20.1)
        median = Money.yen(10)
        median.set_exchanger(DummyExchanger())
        least = Money.dollar(19.9)

        self.check_less_operator_of_rich_comparison(median.__le__, greatest, median, least, True)
開發者ID:Phantom-Bridage,項目名稱:lovely-hotel,代碼行數:9,代碼來源:test_money.py

示例2: testMixedAddition

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [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)
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:9,代碼來源:tests.py

示例3: testSumTimes

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [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)
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:10,代碼來源:tests.py

示例4: test_money_exchange_yen_to_dollar

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
    def test_money_exchange_yen_to_dollar(self):
        money = Money.yen(10)
        money.set_exchanger(DummyExchanger())

        expected = Money.dollar(20)
        result_money = money.exchange("dollar")

        self.assertTrue(expected == result_money)
開發者ID:Phantom-Bridage,項目名稱:lovely-hotel,代碼行數:10,代碼來源:test_money.py

示例5: test_return_the_difference_between_the_different_nationality_money

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
    def test_return_the_difference_between_the_different_nationality_money(self):
        money_yen = Money.yen(10)
        money_yen.set_exchanger(DummyExchanger())
        money_dollar = Money.dollar(2)

        expected = Money.yen(9)
        money_diff = money_yen - money_dollar
        self.assertTrue(expected == money_diff)
開發者ID:Phantom-Bridage,項目名稱:lovely-hotel,代碼行數:10,代碼來源:test_money.py

示例6: test_return_the_sum_of_two_different_nationality_money

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
    def test_return_the_sum_of_two_different_nationality_money(self):
        money_yen = Money.yen(10)
        money_yen.set_exchanger(DummyExchanger())
        money_dollar = Money.dollar(5)

        expected = Money.yen(12.5)
        money_sum = money_yen + money_dollar
        self.assertTrue(expected == money_sum)
開發者ID:Phantom-Bridage,項目名稱:lovely-hotel,代碼行數:10,代碼來源:test_money.py

示例7: test_return_the_money_that_aligned_the_unit_to_currency_of_each_nationality

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
    def test_return_the_money_that_aligned_the_unit_to_currency_of_each_nationality(self):
        money_yen = Money.yen(10.2)
        expected = (10, 0)
        self.assertTrue(expected == money_yen.currency())

        money_dollar = Money.dollar(10.2)
        expected = (10, 20)
        self.assertTrue(expected == money_dollar.currency())
開發者ID:Phantom-Bridage,項目名稱:lovely-hotel,代碼行數:10,代碼來源:test_money.py

示例8: testMultiplication

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
	def testMultiplication(self):
		five = Money.dollar(5)
		self.assertEquals(Money.dollar(10), five.times(2))
		self.assertEquals(Money.dollar(15), five.times(3))
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:6,代碼來源:tests.py

示例9: testReduceMoneyDifferentCurrency

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
	def testReduceMoneyDifferentCurrency(self):
		bank = Bank()
		bank.addRate('CHF', 'USD', 2)
		result = bank.reduce(Money.franc(2), 'USD')
		self.assertEquals(Money.dollar(1), result)
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:7,代碼來源:tests.py

示例10: testReduceMoney

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
	def testReduceMoney(self):
		bank = Bank()
		result = bank.reduce(Money.dollar(1), 'USD')
		self.assertEquals(Money.dollar(1), result)
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:6,代碼來源:tests.py

示例11: testReduceSum

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
	def testReduceSum(self):
		sum = Sum(Money.dollar(3), Money.dollar(4))
		bank = Bank()
		result = bank.reduce(sum, 'USD')
		self.assertEquals(Money.dollar(7), result)
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:7,代碼來源:tests.py

示例12: testPlusReturnsSum

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
	def testPlusReturnsSum(self):
		five = Money.dollar(5)
		sum = five.plus(five)
		self.assertEquals(five, sum.augend)
		self.assertEquals(five, sum.addend)
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:7,代碼來源:tests.py

示例13: testSimpleAddition

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
	def testSimpleAddition(self):
		five = Money.dollar(5)
		sum = five.plus(five)
		bank = Bank()
		reduced = bank.reduce(sum, 'USD')
		self.assertEquals(Money.dollar(10), reduced)
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:8,代碼來源:tests.py

示例14: testEquality

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [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))
開發者ID:lenin,項目名稱:TDDbyExample,代碼行數:6,代碼來源:tests.py

示例15: test_money_recognize_non_equivalent_money_is_not_equal

# 需要導入模塊: from money import Money [as 別名]
# 或者: from money.Money import dollar [as 別名]
 def test_money_recognize_non_equivalent_money_is_not_equal(self):
     money_yen1 = Money.yen(10)
     money_yen2 = Money.yen(20)
     money_dollar = Money.dollar(10)
     self.assertFalse(money_yen1 == money_yen2)
     self.assertFalse(money_yen1 == money_dollar)
開發者ID:Phantom-Bridage,項目名稱:lovely-hotel,代碼行數:8,代碼來源:test_money.py


注:本文中的money.Money.dollar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。