Skip to content

Commit 802975a

Browse files
authored
Merge pull request #630 from fissionprime/characteristic-fix
2 parents 0ec78d6 + 68745ac commit 802975a

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ node_modules
99
.vscode
1010
*.env
1111
Resources/nginx/ssl/*
12-
!Resources/nginx/ssl/*.sample.*
12+
!Resources/nginx/ssl/*.sample.*
13+
.idea*

pokemon_v2/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def get_values(self, obj):
487487

488488
mod = obj.gene_mod_5
489489
values = []
490-
while mod <= 30:
490+
while mod <= 31:
491491
values.append(mod)
492492
mod += 5
493493

pokemon_v2/tests.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class APIData:
14-
""" Data Initializers"""
14+
"""Data Initializers"""
1515

1616
# Gender Data
1717
@classmethod
@@ -4337,6 +4337,20 @@ def test_characteristic_api(self):
43374337
"{}{}/stat/{}/".format(TEST_HOST, API_V2, characteristic.stat.pk),
43384338
)
43394339

4340+
def test_characteristic_values(self):
4341+
# check for all 5 possible values of gene_modulo
4342+
for modulo in range(5):
4343+
characteristic = self.setup_characteristic_data(gene_mod_5=modulo)
4344+
# note that 'possible_values' is computed solely from gene_modulo
4345+
# thus it is fine that our test characteristics are indexed 1-5
4346+
result = self.client.get(
4347+
"{}/characteristic/{}/".format(API_V2, characteristic.pk)
4348+
)
4349+
for i in range(len(result.data["possible_values"])):
4350+
self.assertEqual(
4351+
result.data["possible_values"][i], characteristic.gene_mod_5 + i * 5
4352+
)
4353+
43404354
# Nature Tests
43414355
def test_nature_api(self):
43424356

0 commit comments

Comments
 (0)