Files
python/exercises/dnd-character/dnd_character_test.py

78 lines
2.6 KiB
Python
Raw Normal View History

dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
import unittest
from dnd_character import Character, modifier
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
class DndCharacterTest(unittest.TestCase):
def test_ability_modifier_for_score_3_is_n4(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(3), -4)
def test_ability_modifier_for_score_4_is_n3(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(4), -3)
def test_ability_modifier_for_score_5_is_n3(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(5), -3)
def test_ability_modifier_for_score_6_is_n2(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(6), -2)
def test_ability_modifier_for_score_7_is_n2(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(7), -2)
def test_ability_modifier_for_score_8_is_n1(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(8), -1)
def test_ability_modifier_for_score_9_is_n1(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(9), -1)
def test_ability_modifier_for_score_10_is_0(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(10), 0)
def test_ability_modifier_for_score_11_is_0(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(11), 0)
def test_ability_modifier_for_score_12_is_1(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(12), 1)
def test_ability_modifier_for_score_13_is_1(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(13), 1)
def test_ability_modifier_for_score_14_is_2(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(14), 2)
def test_ability_modifier_for_score_15_is_2(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(15), 2)
def test_ability_modifier_for_score_16_is_3(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(16), 3)
def test_ability_modifier_for_score_17_is_3(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(17), 3)
def test_ability_modifier_for_score_18_is_4(self):
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
self.assertEqual(modifier(18), 4)
def test_random_ability_is_within_range(self):
score = Character().ability()
self.assertIs(score >= 3 and score <= 18, True)
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
def test_random_character_is_valid(self):
Char = Character()
self.assertIs(Char.strength >= 3 and Char.strength <= 18, True)
self.assertIs(Char.dexterity >= 3 and Char.dexterity <= 18, True)
self.assertIs(Char.constitution >= 3 and Char.constitution <= 18, True)
self.assertIs(Char.intelligence >= 3 and Char.intelligence <= 18, True)
self.assertIs(Char.wisdom >= 3 and Char.wisdom <= 18, True)
self.assertIs(Char.charisma >= 3 and Char.charisma <= 18, True)
self.assertIs(Char.hitpoints == 10 + modifier(Char.constitution), True)
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
def test_each_ability_is_only_calculated_once(self):
Char = Character()
self.assertIs(Char.strength == Char.strength, True)
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
if __name__ == "__main__":
dnd-character: implement exercise v1.0.0 (#1613) * sum-of-multiples: update tests to v1.5.0 Fixes exercism#1580 * Updated 3 test cases to conform to canonical data (reordered list to fit the ascending order convention) * Updated example to check for ZeroDivisionError * sum-of-multiples: pep8 formatting connotation Small edits to conform to Pep8 standards * sum-of-multiples: pep8 formatting connotation Even smaller updates to conform to pep8 * sum-of_multiples: update import list Change import to link to correct file * sum-of-multiples: update tests to v1.5.0 * Updated test case names to reflect significance of each case. * Updated example.py for brevity * sum-of-multiples: update * Delete blank line * phone-number: update tests to v1.6.1 Fixes #1582 * Version increment. * dnd-character: implement exercise v1.0.0 Closes #1593 * DND exercise implemented with corresponding tests and example * Updated README.md * dnd-character: implement exercise v1.0.0 Update #1613 * Del character{} from dnd_character.py * Modified test cases to fit the exercise implementation in dnd_charact_test.py * Modified example.py to exemplify spirit of exercise and deleted the character{} * Implemented the README.md using the configlet tool * dnd-character: implement exercise v1.0.0 Update config.json to reference this exercise. * Update config.json "unlocked_by" updated to reference "robot-name" Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * Update config.json unlocked_by: null Co-Authored-By: GascaK <gasca.kevin.a@gmail.com> * dnd-character: update tests to v1.1.0 Closes #1593 * Update config.json * Update _test.py to correctly reflect the canonical data. * Update _test.py Update to include max roll of 18.
2018-12-13 10:59:44 -08:00
unittest.main()