本文整理汇总了Python中gittip.billing.payday.Payday.pachinko方法的典型用法代码示例。如果您正苦于以下问题:Python Payday.pachinko方法的具体用法?Python Payday.pachinko怎么用?Python Payday.pachinko使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gittip.billing.payday.Payday
的用法示例。
在下文中一共展示了Payday.pachinko方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestPachinko
# 需要导入模块: from gittip.billing.payday import Payday [as 别名]
# 或者: from gittip.billing.payday.Payday import pachinko [as 别名]
class TestPachinko(Harness):
def setUp(self):
Harness.setUp(self)
self.payday = Payday(self.db)
def test_get_participants_gets_participants(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20)
a_team.add_member(self.make_participant('alice', claimed_time='now'))
a_team.add_member(self.make_participant('bob', claimed_time='now'))
ts_start = self.payday.start()
actual = [p.username for p in self.payday.get_participants(ts_start)]
expected = ['a_team', 'alice', 'bob']
assert actual == expected
def test_pachinko_pachinkos(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, pending=0)
a_team.add_member(self.make_participant('alice', claimed_time='now', balance=0, pending=0))
a_team.add_member(self.make_participant('bob', claimed_time='now', balance=0, pending=0))
ts_start = self.payday.start()
participants = self.payday.genparticipants(ts_start, ts_start)
self.payday.pachinko(ts_start, participants)
示例2: TestPachinko
# 需要导入模块: from gittip.billing.payday import Payday [as 别名]
# 或者: from gittip.billing.payday.Payday import pachinko [as 别名]
class TestPachinko(Harness):
def setUp(self):
Harness.setUp(self)
self.payday = Payday(self.db)
def test_get_participants_gets_participants(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20)
a_team.add_member(self.make_participant('alice', claimed_time='now'))
a_team.add_member(self.make_participant('bob', claimed_time='now'))
ts_start = self.payday.start()
actual = [p.username for p in self.payday.get_participants(ts_start)]
expected = ['a_team', 'alice', 'bob']
assert actual == expected
def test_pachinko_pachinkos(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
a_team.add_member(self.make_participant('alice', claimed_time='now', balance=0, pending=0))
a_team.add_member(self.make_participant('bob', claimed_time='now', balance=0, pending=0))
ts_start = self.payday.start()
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username('alice').pending == D('0.01')
assert Participant.from_username('bob').pending == D('0.01')
def test_pachinko_sees_current_take(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
alice = self.make_participant('alice', claimed_time='now', balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D('1.00'), alice)
ts_start = self.payday.start()
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username('alice').pending == D('1.00')
def test_pachinko_ignores_take_set_after_payday_starts(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
alice = self.make_participant('alice', claimed_time='now', balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D('0.33'), alice)
ts_start = self.payday.start()
a_team.set_take_for(alice, D('1.00'), alice)
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username('alice').pending == D('0.33')
def test_pachinko_ignores_take_thats_already_been_processed(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
alice = self.make_participant('alice', claimed_time='now', balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D('0.33'), alice)
ts_start = self.payday.start()
a_team.set_take_for(alice, D('1.00'), alice)
for i in range(4):
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username('alice').pending == D('0.33')
示例3: TestPachinko
# 需要导入模块: from gittip.billing.payday import Payday [as 别名]
# 或者: from gittip.billing.payday.Payday import pachinko [as 别名]
class TestPachinko(Harness):
def setUp(self):
Harness.setUp(self)
self.payday = Payday(self.db)
def test_get_participants_gets_participants(self):
a_team = self.make_participant("a_team", claimed_time="now", number="plural", balance=20)
a_team.add_member(self.make_participant("alice", claimed_time="now"))
a_team.add_member(self.make_participant("bob", claimed_time="now"))
ts_start = self.payday.start()
actual = [p.username for p in self.payday.get_participants(ts_start)]
expected = ["a_team", "alice", "bob"]
assert actual == expected
def test_pachinko_pachinkos(self):
a_team = self.make_participant("a_team", claimed_time="now", number="plural", balance=20, pending=0)
a_team.add_member(self.make_participant("alice", claimed_time="now", balance=0, pending=0))
a_team.add_member(self.make_participant("bob", claimed_time="now", balance=0, pending=0))
ts_start = self.payday.start()
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username("alice").pending == D("0.01")
assert Participant.from_username("bob").pending == D("0.01")
def test_pachinko_sees_current_take(self):
a_team = self.make_participant("a_team", claimed_time="now", number="plural", balance=20, pending=0)
alice = self.make_participant("alice", claimed_time="now", balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D("1.00"), alice)
ts_start = self.payday.start()
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username("alice").pending == D("1.00")
def test_pachinko_ignores_take_set_after_payday_starts(self):
a_team = self.make_participant("a_team", claimed_time="now", number="plural", balance=20, pending=0)
alice = self.make_participant("alice", claimed_time="now", balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D("0.33"), alice)
ts_start = self.payday.start()
a_team.set_take_for(alice, D("1.00"), alice)
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username("alice").pending == D("0.33")
def test_pachinko_ignores_take_thats_already_been_processed(self):
a_team = self.make_participant("a_team", claimed_time="now", number="plural", balance=20, pending=0)
alice = self.make_participant("alice", claimed_time="now", balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D("0.33"), alice)
ts_start = self.payday.start()
a_team.set_take_for(alice, D("1.00"), alice)
for i in range(4):
participants = self.payday.genparticipants(ts_start, LOOP_PACHINKO)
self.payday.pachinko(ts_start, participants)
assert Participant.from_username("alice").pending == D("0.33")