Пример #1
0
 def test_per_sprinter(self):
     alice = SprinterFactory.create()
     change = SprinterChangeFactory.create(sprinter=alice)
     pull = SprinterPullFactory.create(sprinter=alice)
     generator = per_sprinter([alice])
     sprinter, sprinter_changes, sprinter_pulls = list(generator)[0]
     expect(sprinter) == alice
     expect(list(sprinter_changes)) == [change]
     expect(list(sprinter_pulls)) == [pull]
Пример #2
0
def process_achievements(sprinters):
    achievements = Achievement.objects.all()
    sprinters_and_changes = per_sprinter(sprinters)
    processor = Processor(achievements)
    processor.grant(sprinters_and_changes)