-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_locations_language_info.py
More file actions
75 lines (65 loc) · 2.84 KB
/
test_locations_language_info.py
File metadata and controls
75 lines (65 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""This file contains tests to ensure all specified locations pass basic sanity checks.
Imports From:
campaign.py
report.py
Functions:
test_campaign_data_locations()
"""
from campaign import Campaign
from report import Report
def test_locations_language_info(current_campaign: Campaign) -> Report:
"""Test all locations specified for sanity
Parameters:
current_campaign: Campaign | The parsed campaign to be tested
Returns:
Report | The completed Report to be returned
"""
report = Report()
if current_campaign.language_info.location_names is not None:
if len(current_campaign.campaign_data.locations) != len(
current_campaign.language_info.location_names
):
report.errors.append(
f"ERROR: There are {len(current_campaign.campaign_data.locations)} "
"Locations specified in campaign_data.txt but "
f"{len(current_campaign.language_info.location_names)} LocationNames "
"in campaign_map_data.txt."
)
else:
report.errors.append(
f"ERROR: language_{current_campaign.language_info.language}\\"
"campaign_map_data.txt not found."
)
if current_campaign.waypoints.sea_waypoints is not None:
if current_campaign.language_info.sea_names is not None:
if len(current_campaign.waypoints.sea_waypoints) != len(
current_campaign.language_info.sea_names
):
report.errors.append(
f"ERROR: There are {len(current_campaign.waypoints.sea_waypoints)} "
"sea waypoints specified in waypoints_sea.txt but "
f"{len(current_campaign.language_info.sea_names)} sea names "
"in waypoints_sea_names.txt."
)
else:
report.errors.append(
f"ERROR: language_{current_campaign.language_info.language}\\"
"waypoints_sea_names.txt not found."
)
if current_campaign.waypoints.land_waypoints is not None:
if current_campaign.language_info.region_names is not None:
if len(current_campaign.waypoints.land_waypoints) != len(
current_campaign.language_info.region_names
):
report.errors.append(
f"ERROR: There are {len(current_campaign.waypoints.land_waypoints)} "
"land waypoints specified in waypoints_region.txt but "
f"{len(current_campaign.language_info.region_names)} region names "
"in waypoints_region_names.txt."
)
else:
report.errors.append(
f"ERROR: language_{current_campaign.language_info.language}\\"
"waypoints_region_names.txt not found."
)
return report