def test_process_class_key_parses_multiple_classes(self): classes = "Bard=3|Cleric,Wizard=4" spell = SpellParser() spell.processSpelllistKeyValue(("classes", classes)) self.assertEqual(spell.classes, { 'Bard': 3, 'Wizard': 4, 'Cleric': 4 })
def test_process_class_key_parses_complex_class(self): classes = "Bard=3[PRESKILL:1,Perform (String Instruments)=7,Perform (Wind Instruments)=7]|Cleric,Wizard=4" spell = SpellParser() spell.processSpelllistKeyValue(("classes", classes)) self.assertEqual(spell.classes, { 'Bard': 3, 'Wizard': 4, 'Cleric': 4 })
def test_parse_line_calls_parse_keyword_and_process_key_value_once_for_each_keyword(self): blank = SpellParser() mock_keyword = blank.parseKeyword = mock.Mock(return_value=[("school", "Evocation"), ("spellres", "No")]) mock_parsekey = blank.processKeyValue = mock.Mock() blank.parseLine("Acid Splash\tSCHOOL:Evocation\t\tSPELLRES:No") mock_keyword.assert_has_calls([mock.call("SCHOOL:Evocation"), mock.call("SPELLRES:No")]) mock_parsekey.assert_hash_calls([mock.call(("school", "Evocation")), mock.call(("spellres", "No"))])
def test_parse_list_keyvalue_sets_list(self): blank = SpellParser() blank.processListKeyValue(("type", "Arcane.Divine")) self.assertEquals(blank.type, ["Arcane", "Divine"])
def test_parse_keyvalue_sets_school_when_given(self): blank = SpellParser() blank.processKeyValue(("school", "Evocation")) self.assertEquals(blank.school, "Evocation")
def test_process_class_key_parses_simple_class(self): classes = "Bard=3" spell = SpellParser() spell.processSpelllistKeyValue(("classes", classes)) self.assertEqual(spell.classes, {'Bard': 3})