def get_temple_points(self, cursor, force_requery=False): if self.nomadic: if self.size >= 20000: return 1 else: return 0 if self.temple_points != -999 and force_requery == False: return self.temple_points building_completion, building_amount = self.get_buildings(cursor) temple_points = 0 for building_id, amount in building_amount.items(): temple_points += (building_rules.temple_points(building_id) * amount) self.temple_points = temple_points return self.temple_points
def test_temple_points(self): vals = ( # Temple (22, 0), (23, 1), (24, 0), ("Temple", 1), # Expanded temple (49, 0), (50, 2), (51, 0), ("Expanded temple", 2), ) for the_building, expected in vals: r = building_rules.temple_points(the_building) self.assertEqual(expected, r)