本文整理汇总了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)
}
)