コード例 #1
0
    def test_max_stats(self):
        luke = Guest('Luke', LUKE_STATS)
        self.assertTrue('Contract' not in luke.stats.top_stats())
        self.assertTrue('Fragment' in luke.stats.top_stats())
        self.assertTrue('Surveying' in luke.stats.top_stats())

        # if the guest has no stat set, all stats are on the top stats
        kota = Guest('Kota')
        self.assertEqual(len(kota.stats.top_stats()), 7)
コード例 #2
0
ファイル: test_ui.py プロジェクト: nanoffminoh/minohRefactor
 def test_asterion_team_filename_matches_fur_color(self):
     asterion = Guest('Asterion', ASTERION_STATS)
     luke = Guest('Luke', LUKE_STATS)
     guest_list = GuestList()
     guest_list.add_guest(luke)
     guest_list.add_guest(asterion)
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Asterion'), 'gui/inventory/icons/char_Asterion_color')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Asterion', asterion_fur='white'), 'gui/inventory/icons/char_Asterion_color')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Asterion', asterion_fur='brown'), 'gui/inventory/icons/char_Asterion_color_brown')
     # check if adding asterion_fur affects luke's filename
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke'), 'gui/inventory/icons/char_Luke_color')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke', asterion_fur='brown'), 'gui/inventory/icons/char_Luke_color')
コード例 #3
0
 def test_get_next_guest_scene(self):
     luke = Guest('Luke', LUKE_STATS)
     kota = Guest('Kota', KOTA_STATS)
     current_build_max = {'Luke': 3, 'Kota': 1}
     guest_route_max = {'Luke': 3, 'Kota': 2}
     guest_list = GuestList()
     guest_list.add_guest(luke)
     guest_list.add_guest(kota)
     self.assertEqual(guest_list.get_next_guest_scene('Luke'), 'Luke_0')
     self.assertEqual(guest_list.get_next_guest_scene('Kota'), 'Kota_0')
     guest_list.advance_guest_route('Luke', guest_route_max)
     self.assertEqual(guest_list.get_next_guest_scene('Luke'), 'Luke_1')
コード例 #4
0
 def test_start_relationship_modifies_guest_list(self):
     luke = Guest('Luke', preset_guest_stats['Luke'])
     black = Guest('Black', preset_guest_stats['Black'])
     luke_black = Relationship(['Luke', 'Black'], stats=preset_couple_stats['Luke,Black']['stats'])
     guest_list = GuestList()
     guest_list.add_guest(luke)
     guest_list.add_guest(black)
     rel_list = RelationshipList()
     rel_list.add_relationship(luke_black)
     self.assertEqual(rel_list.get_relationship_progress('Luke'), 0)
     self.assertEqual(guest_list.guests['Luke'].romance_status, 'single')
     rel_list.advance_relationship(['Luke', 'Black'], guest_list=guest_list)
     self.assertEqual(rel_list.get_relationship_progress('Luke'), 1)
     self.assertEqual(guest_list.guests['Luke'].romance_status, 'dating')
     self.assertEqual(guest_list.guests['Luke'].romance_partner, 'Black')
     self.assertEqual(rel_list.get_relationship_status('Luke,Black'), 'started')
コード例 #5
0
ファイル: test_ui.py プロジェクト: nanoffminoh/minohRefactor
 def test_get_luke_team_filename(self):
     luke = Guest('Luke', LUKE_STATS)
     guest_list = GuestList()
     guest_list.add_guest(luke)
     self.assertEqual(guest_list.get_guest_status('Luke'), 'available')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke'), 'gui/inventory/icons/char_Luke_color')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke', size='big'),
                      'gui/inventory/icons/big/char_Luke_color')
コード例 #6
0
 def test_create_guest_list(self):
     luke = Guest('Luke', LUKE_STATS)
     guest_list = GuestList()
     self.assertFalse(guest_list.has_guest('Luke'))
     guest_list.add_guest(luke)
     self.assertTrue(guest_list.has_guest('Luke'))
     self.assertEqual(guest_list.get_guest_status('Luke'), 'available')
     self.assertEqual(guest_list.get_free_guests().names()[0], 'Luke')
コード例 #7
0
 def test_advance_day_doesnt_affect_avialiable_guest(self):
     luke = Guest('Luke', LUKE_STATS)
     self.assertEqual(luke.status, 'available')
     self.assertEqual(luke.days_off, 0)
     luke.advance_day()
     self.assertEqual(luke.status, 'available')
     self.assertEqual(luke.days_off, 0)
     luke.set_status('RD')
     luke.advance_day()
     self.assertEqual(luke.days_off, 0)
コード例 #8
0
 def test_move_guests_around(self):
     luke = Guest('Luke', LUKE_STATS)
     kota = Guest('Kota', KOTA_STATS)
     guest_list = GuestList()
     guest_list.add_guest(luke)
     guest_list.add_guest(kota)
     self.assertEqual(guest_list.get_guest_status('Luke'), 'available')
     self.assertEqual(guest_list.get_guest_status('Kota'), 'available')
     self.assertTrue('Luke' in guest_list.get_free_guests().names())
     guest_list.send_guest_to_rd('Luke')
     self.assertFalse('Luke' in guest_list.get_free_guests().names())
     self.assertTrue('Luke' in guest_list.get_rd_team().names())
     guest_list.send_guest_to_exploration('Kota')
     self.assertFalse('Kota' in guest_list.get_free_guests().names())
     self.assertTrue('Kota' in guest_list.get_exploration_team().names())
     guest_list.free_guest('Luke')
     self.assertTrue('Luke' in guest_list.get_free_guests().names())
     self.assertFalse('Luke' in guest_list.get_rd_team().names())
コード例 #9
0
 def test_guest_advance_days_to_recover(self):
     luke = Guest('Luke', LUKE_STATS)
     luke.disable_guest(3)
     self.assertEqual(luke.status, 'unavailable')
     self.assertEqual(luke.days_off, 3)
     luke.advance_day(2)
     self.assertEqual(luke.status, 'unavailable')
     self.assertEqual(luke.days_off, 1)
     luke.advance_day()
     self.assertEqual(luke.status, 'available')
     self.assertEqual(luke.days_off, 0)
コード例 #10
0
 def test_add_extra_sick_days(self):
     luke = Guest('Luke', LUKE_STATS)
     luke.disable_guest(3)
     self.assertEqual(luke.status, 'unavailable')
     self.assertEqual(luke.days_off, 3)
     luke.advance_day()
     self.assertEqual(luke.status, 'unavailable')
     self.assertEqual(luke.days_off, 2)
     luke.disable_guest(5)
     self.assertEqual(luke.status, 'unavailable')
     self.assertEqual(luke.days_off, 7)
コード例 #11
0
 def test_team_stat_total(self):
     luke = Guest('Luke', LUKE_STATS)
     kota = Guest('Kota', KOTA_STATS)
     guest_list = GuestList()
     guest_list.add_guest(luke)
     guest_list.add_guest(kota)
     self.assertEqual(len(guest_list.get_rd_team()), 0)
     self.assertEqual(
         guest_list.get_rd_team().sum_stats().get_value('Contract'), 0)
     guest_list.send_guest_to_rd('Luke')
     self.assertEqual(len(guest_list.get_rd_team()), 1)
     self.assertEqual(
         guest_list.get_rd_team().sum_stats().get_value('Contract'),
         LUKE_STATS['Contract'])
     guest_list.send_guest_to_rd('Kota')
     self.assertEqual(len(guest_list.get_rd_team()), 2)
     self.assertEqual(
         guest_list.get_rd_team().sum_stats().get_value('Contract'),
         LUKE_STATS['Contract'] + KOTA_STATS['Contract'])
コード例 #12
0
ファイル: test_ui.py プロジェクト: nanoffminoh/minohRefactor
 def test_orange_team_filename_if_unavailable(self):
     luke = Guest('Luke', LUKE_STATS)
     guest_list = GuestList()
     guest_list.add_guest(luke)
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke'), 'gui/inventory/icons/char_Luke_color')
     guest_list.send_guest_to_exploration('Luke')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke'), 'gui/inventory/icons/char_Luke_color')
     guest_list.disable_guest('Luke')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke'), 'gui/inventory/icons/char_Luke_orange')
     self.assertEqual(get_guest_team_filename(guest_list, guest_name='Luke', size='big'),
                      'gui/inventory/icons/big/char_Luke_orange')
コード例 #13
0
 def test_guest_status(self):
     luke = Guest('Luke', LUKE_STATS)
     self.assertEqual(luke.status, 'available')
     luke.set_status('RD')
     self.assertEqual(luke.status, 'RD')
     luke.disable_guest()
     self.assertEqual(luke.status, 'unavailable')
コード例 #14
0
 def test_available_routes(self):
     luke = Guest('Luke', LUKE_STATS)
     kota = Guest('Kota', KOTA_STATS)
     current_build_max = {'Luke': 3, 'Kota': 1}
     guest_route_max = {'Luke': 3, 'Kota': 2}
     guest_list = GuestList()
     guest_list.add_guest(luke)
     guest_list.add_guest(kota)
     choices, guests = guest_list.get_available_guest_routes(
         current_build_max)
     self.assertEqual(choices, [("Luke's scene #0", 'Luke_0'),
                                ("Kota's scene #0", 'Kota_0')])
     self.assertEqual(guests, ['Luke', 'Kota'])
     guest_list.send_guest_to_rd('Kota')
     choices, guests = guest_list.get_available_guest_routes(
         current_build_max)
     self.assertEqual(choices, [("Luke's scene #0", 'Luke_0')])
     self.assertEqual(guests, ['Luke'])
     guest_list.free_guest('Kota')
     guest_list.advance_guest_route('Luke', guest_route_max)
     choices, guests = guest_list.get_available_guest_routes(
         current_build_max)
     self.assertEqual(choices, [("Luke's scene #1", 'Luke_1'),
                                ("Kota's scene #0", 'Kota_0')])
     self.assertEqual(guests, ['Luke', 'Kota'])
     self.assertEqual(guest_list.guests['Kota'].route_progress, 0)
     guest_list.advance_guest_route('Kota', guest_route_max)
     self.assertEqual(guest_list.guests['Kota'].route_progress, 1)
     choices, guests = guest_list.get_available_guest_routes(
         current_build_max)
     self.assertEqual(choices, [("Luke's scene #1", 'Luke_1')])
     self.assertEqual(guests, ['Luke'])
     guest_list.advance_guest_route('Luke', guest_route_max, 2)
     self.assertTrue(guest_list.guests['Luke'].route_complete)
     choices, guests = guest_list.get_available_guest_routes(
         current_build_max)
     self.assertEqual(choices, [])
     self.assertEqual(guests, [])
コード例 #15
0
    def register_guest(self, name, arrival, apartment_id):
        try:
            arrival = datetime.datetime.strptime(arrival, '%Y-%m-%d %H:%M')
            guest = Guest(name=name,
                          arrival=arrival,
                          apartment_id=apartment_id)
            db.session.add(guest)
            db.session.commit()

            return guest.id

        except exc.IntegrityError:
            db.session.rollback()
            return None
コード例 #16
0
ファイル: test_ui.py プロジェクト: nanoffminoh/minohRefactor
 def test_inventory_filename(self):
     guest_list = GuestList()
     luke = Guest('Luke', LUKE_STATS)
     known_guests = []
     # luke is not known
     self.assertEqual(get_guest_inventory_filename(guest_list, guest_name='Luke', known_guests=known_guests),
                      'gui/inventory/icons/char_Luke_black')
     # luke is known from another playthrough but not currently checked in
     known_guests.append('Luke')
     self.assertEqual(get_guest_inventory_filename(guest_list, guest_name='Luke', known_guests=known_guests),
                      'gui/inventory/icons/char_Luke_orange')
     # luke is added to the current playthrough's guest list
     guest_list.add_guest(luke)
     self.assertEqual(get_guest_inventory_filename(guest_list, guest_name='Luke', known_guests=known_guests),
                      'gui/inventory/icons/char_Luke_color')
コード例 #17
0
ファイル: test_ui.py プロジェクト: nanoffminoh/minohRefactor
 def test_guest_tooltip(self):
     guest_list = GuestList()
     luke = Guest('Luke', LUKE_STATS)
     known_guests = []
     # luke is not known
     self.assertEqual(get_guest_tooltip(guest_list, known_guests=known_guests, guest_name='Luke', guest_desc=preset_guest_descriptions['Luke']),
                      {'title': '???', 'description': ''})
     # luke is known from another playthrough but not currently checked in
     known_guests.append('Luke')
     self.assertEqual(get_guest_tooltip(guest_list, known_guests=known_guests, guest_name='Luke', guest_desc=preset_guest_descriptions['Luke']),
                      {'title': 'Luke', 'description': ''})
     # luke is added to the current playthrough's guest list
     guest_list.add_guest(luke)
     self.assertEqual(get_guest_tooltip(guest_list, known_guests=known_guests, guest_name='Luke', guest_desc=preset_guest_descriptions['Luke']),
                      {'title': 'Luke', 'description': preset_guest_descriptions['Luke']})
コード例 #18
0
 def test_guest_route(self):
     luke = Guest('Luke', LUKE_STATS)
     self.assertEqual(luke.route_progress, 0)
     self.assertFalse(luke.route_complete)
     luke.advance_route(1, MAX_ROUTES['Luke'])
     self.assertEqual(luke.route_progress, 1)
     self.assertFalse(luke.route_complete)
     luke.advance_route(3, MAX_ROUTES['Luke'])
     self.assertEqual(luke.route_progress, 4)
     self.assertTrue(luke.route_complete)
コード例 #19
0
 def test_advance_day_does_not_affect_permanently_disabled_guest(self):
     luke = Guest('Luke', LUKE_STATS)
     self.assertEqual(luke.status, 'available')
     self.assertEqual(luke.days_off, 0)
     luke.disable_guest()
     self.assertEqual(luke.status, 'unavailable')
     self.assertEqual(luke.days_off, -1)
     luke.advance_day()
     self.assertEqual(luke.status, 'unavailable')
     self.assertEqual(luke.days_off, -1)
コード例 #20
0
 def test_create_guest(self):
     new_guest = Guest('Luke')
     self.assertEqual(new_guest.name, 'Luke')
コード例 #21
0
 def test_guest_stats_initialize_not_empty(self):
     new_guest = Guest('Kota', KOTA_STATS)
     self.assertEqual(new_guest.stats.get_value('Contract'),
                      KOTA_STATS['Contract'])
コード例 #22
0
 def test_guest_can_advance_route(self):
     luke = Guest('Luke', LUKE_STATS)
     current_route_max = 2
     route_max = 3
     self.assertTrue(luke.can_advance_route(current_route_max))
     luke.advance_route(1, route_max)
     self.assertTrue(luke.can_advance_route(current_route_max))
     # send to RD, won't be able to advance
     luke.set_status('RD')
     self.assertFalse(luke.can_advance_route(current_route_max))
     luke.set_status('available')
     self.assertTrue(luke.can_advance_route(current_route_max))
     # advance route to the max available in the build, won't be able to advance
     luke.advance_route(1, route_max)
     self.assertFalse(luke.can_advance_route(current_route_max))
     # raise the build's current maximum route, will be able to advance
     current_route_max = 3
     self.assertTrue(luke.can_advance_route(current_route_max))
     # luke advances and completes his route, cannot advance anymore
     luke.advance_route(1, route_max)
     self.assertFalse(luke.can_advance_route(current_route_max))
コード例 #23
0
def load_guest(guest_name, guest_stat_dict):
    stats = guest_stat_dict[guest_name]
    return Guest(guest_name, stats)
コード例 #24
0
 def test_can_date(self):
     luke = Guest('Luke', LUKE_STATS)
     self.assertFalse(luke.can_date())
     self.assertEqual(luke.route_progress, 0)
     self.assertFalse(luke.route_complete)
     luke.advance_route(MAX_ROUTES['Luke'] - 1, MAX_ROUTES['Luke'])
     self.assertFalse(luke.route_complete)
     luke.advance_route(1, MAX_ROUTES['Luke'])
     self.assertTrue(luke.route_complete)
     self.assertTrue(luke.can_date())
     self.assertTrue(luke.can_start_relationship())
     luke.set_status('RD')
     self.assertFalse(luke.can_date())
     self.assertFalse(luke.can_start_relationship())