Skip to content

Commit 28da537

Browse files
authored
Fix spell data regressions and omissions (#844)
* Fix spell data regressions from PR #842 and update newrelic API * add missing higher-leve options * add tests for duplicate or missing higher_level values * Add missing casting options for deepm and spells-that-dont-suck * fix freezing sphere being merged with freedom of movement
1 parent f9f94b8 commit 28da537

File tree

8 files changed

+42652
-40306
lines changed

8 files changed

+42652
-40306
lines changed

api_v2/tests/test_objects.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,44 @@
55

66
API_BASE = f"http://localhost:8000"
77

8+
9+
class TestSpellCastingOptions:
10+
"""Tests to validate spell casting options data integrity."""
11+
12+
def test_all_spells_with_higher_level_have_casting_options(self):
13+
"""Every spell with higher_level text should have at least one casting option."""
14+
response = requests.get(
15+
f"{API_BASE}/v2/spells/?limit=1000",
16+
headers={'Accept': 'application/json'}
17+
).json()
18+
19+
spells_missing_options = []
20+
for spell in response['results']:
21+
if spell.get('higher_level') and not spell.get('casting_options'):
22+
spells_missing_options.append(spell['key'])
23+
24+
assert not spells_missing_options, \
25+
f"Spells with higher_level but no casting_options: {spells_missing_options}"
26+
27+
def test_no_duplicate_casting_option_types(self):
28+
"""No spell should have duplicate casting option types."""
29+
response = requests.get(
30+
f"{API_BASE}/v2/spells/?limit=1000",
31+
headers={'Accept': 'application/json'}
32+
).json()
33+
34+
spells_with_duplicates = []
35+
for spell in response['results']:
36+
casting_options = spell.get('casting_options', [])
37+
types = [opt['type'] for opt in casting_options]
38+
if len(types) != len(set(types)):
39+
duplicates = [t for t in types if types.count(t) > 1]
40+
spells_with_duplicates.append(f"{spell['name']}: {set(duplicates)}")
41+
42+
assert not spells_with_duplicates, \
43+
f"Spells with duplicate casting option types: {spells_with_duplicates}"
44+
45+
846
class TestObjects:
947

1048
def _verify(self, endpoint: str, transformer: Callable[[dict], None] = None):

data/raw_sources/srd_5_2/sections/08_b_spellsaz.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,7 @@ In addition, the target can spend 5 feet of movement to automatically escape fro
25982598

25992599
**_Using a Higher-Level Spell Slot._** You can target one additional creature for each spell slot level above 4.
26002600

2601-
### Freezing Sphere
2601+
#### Freezing Sphere
26022602

26032603
*Level 6 Evocation (Sorcerer, Wizard)*
26042604

0 commit comments

Comments
 (0)