本文整理匯總了Python中app.calculator.Calculator.amount方法的典型用法代碼示例。如果您正苦於以下問題:Python Calculator.amount方法的具體用法?Python Calculator.amount怎麽用?Python Calculator.amount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app.calculator.Calculator
的用法示例。
在下文中一共展示了Calculator.amount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: CalculatorTest
# 需要導入模塊: from app.calculator import Calculator [as 別名]
# 或者: from app.calculator.Calculator import amount [as 別名]
class CalculatorTest(unittest.TestCase):
def setUp(self):
self.event = Event(pk=1)
self.calculator = Calculator(self.event)
def testAmount(self):
self.assertEqual(self.calculator.amount(), 100)
示例2: get
# 需要導入模塊: from app.calculator import Calculator [as 別名]
# 或者: from app.calculator.Calculator import amount [as 別名]
def get(self, request):
participant = Participant.objects.get(
Q(email=request.user.username) | Q(email=request.user.email)
)
event = participant.event.select_related()[0]
calculator = Calculator(event)
return Response(
status.HTTP_200_OK,
{
"event" : event,
"participant" : participant,
"amount" : calculator.amount(),
"participantAmount": calculator.participantAmount(participant)
}
)