コード例 #1
0
    def test_filter_class(self):
        spells = [x[0] for x in generate.get_spells(classes={"Warlock", "Fighter"})]
        self.assertIn("Alarm", spells)
        self.assertIn("Astral Projection", spells)
        self.assertNotIn("Augury", spells)

        spells = generate.get_spells(classes={"NotAClass"})
        self.assertEqual(len(spells), 0)
コード例 #2
0
    def test_filter_schools(self):
        spells = [x[0] for x in generate.get_spells(schools={"Abjuration"})]
        self.assertIn("Alarm", spells)
        self.assertNotIn("Augury", spells)

        spells = [x[0] for x in generate.get_spells(schools={"NotASchool"})]
        self.assertNotIn("Alarm", spells)
        self.assertNotIn("Augury", spells)
        self.assertEqual(len(spells), 0)
コード例 #3
0
    def test_filter_names(self):
        spells = {x[0] for x in generate.get_spells(names={"Augury"})}
        self.assertEqual({"Augury"}, spells)

        spells = {x[0] for x in generate.get_spells(names={"Augury", "Prestidigitation"})}
        self.assertEqual({"Augury", "Prestidigitation"}, spells)
        self.assertEqual(len(spells), 2)

        spells = {x[0] for x in generate.get_spells(names={"NotASpell"})}
        self.assertEqual(set(), spells)
コード例 #4
0
    def test_filter_levels(self):
        spells = [x[0] for x in generate.get_spells(levels={0})]
        self.assertIn("Prestidigitation", spells)
        self.assertNotIn("Augury", spells)

        spells = [x[0] for x in generate.get_spells(levels={2})]
        self.assertIn("Augury", spells)
        self.assertNotIn("Prestidigitation", spells)

        spells = [x[0] for x in generate.get_spells(levels={0, 2})]
        self.assertIn("Augury", spells)
        self.assertIn("Prestidigitation", spells)

        self.assertEqual(len(generate.get_spells(levels={9000})), 0)
コード例 #5
0
 def test_nofilter(self):
     spells = generate.get_spells()
     self.assertEqual(len(spells), len(generate.SPELLS))