コード例 #1
0
ファイル: test_logic.py プロジェクト: he1mdallr/the-tale
    def test_move_person_to_place(self):
        person = self.place_1.persons[0]

        self.assertEqual(person.moved_at_turn, 0)

        game_time = TimePrototype.get_current_time()
        game_time.increment_turn()
        game_time.increment_turn()
        game_time.increment_turn()

        with self.check_changed(lambda: storage.persons.version):
            logic.move_person_to_place(person, self.place_3)

        self.assertEqual(person.moved_at_turn, 3)
        self.assertEqual(person.place.id, self.place_3.id)
コード例 #2
0
ファイル: test_logic.py プロジェクト: ruckysolis/the-tale
    def test_move_person_to_place(self):
        person = self.place_1.persons[0]

        self.assertEqual(person.moved_at_turn, 0)

        game_time = TimePrototype.get_current_time()
        game_time.increment_turn()
        game_time.increment_turn()
        game_time.increment_turn()

        with self.check_changed(lambda: storage.persons.version):
            logic.move_person_to_place(person, self.place_3)

        self.assertEqual(person.moved_at_turn, 3)
        self.assertEqual(person.place.id, self.place_3.id)
コード例 #3
0
ファイル: test_objects.py プロジェクト: Tiendil/the-tale
    def test_refresh_attributes__stability_penalty_for_masters_number(self):
        self.p1.refresh_attributes()

        with self.check_not_changed(lambda: self.p1.attrs.stability):
            while len(self.p1.persons) < c.PLACE_MAX_PERSONS:
                person = random.choice(list(persons_storage.persons.all()))
                persons_logic.move_person_to_place(person, self.p1)

            self.p1.refresh_attributes()

        with self.check_delta(lambda: self.p1.attrs.stability, -0.25):
            while len(self.p1.persons) <= c.PLACE_MAX_PERSONS:
                person = random.choice(list(persons_storage.persons.all()))
                persons_logic.move_person_to_place(person, self.p1)

            self.p1.refresh_attributes()
コード例 #4
0
ファイル: test_objects.py プロジェクト: he1mdallr/the-tale
    def test_refresh_attributes__stability_penalty_for_masters_number(self):
        self.p1.refresh_attributes()

        with self.check_not_changed(lambda: self.p1.attrs.stability):
            while len(self.p1.persons) < c.PLACE_MAX_PERSONS:
                person = random.choice(list(persons_storage.persons.all()))
                persons_logic.move_person_to_place(person, self.p1)

            self.p1.refresh_attributes()

        with self.check_delta(lambda: round(self.p1.attrs.stability, 2), -0.15000000000000002):
            while len(self.p1.persons) <= c.PLACE_MAX_PERSONS:
                person = random.choice(list(persons_storage.persons.all()))
                persons_logic.move_person_to_place(person, self.p1)

            self.p1.refresh_attributes()
コード例 #5
0
    def apply(self, bill=None):
        if not self.has_meaning():
            return

        persons_logic.move_person_to_place(self.person, self.new_place)
コード例 #6
0
    def apply(self, bill=None):
        if not self.has_meaning():
            return

        persons_logic.move_person_to_place(self.person, self.new_place)