示例#1
0
 def testGetIsMod(self):
     mod = ModParser.parse("is x >= 3".split(" "), self.attributes)
     self.assertEqual({
         "attribute": "x",
         "comparison": ">=",
         "against": "3"
     }, mod.args)
     self.assertEqual("has_attribute", mod.method)
示例#2
0
 def testApplyHasModFails(self):
     mod = ModParser.parse("has a 3".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertFalse(result)
示例#3
0
 def testApplyHasModMultipleQuantity(self):
     mod = ModParser.parse("has a 2".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#4
0
 def testGetHasMod(self):
     mod = ModParser.parse("has a 12".split(" "), self.attributes)
     self.assertEqual({"item_type": "a", "amount": "12"}, mod.args)
     self.assertEqual("has_item", mod.method)
示例#5
0
 def testApplyRndMod(self):
     mod = ModParser.parse("random 100".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#6
0
 def testGetRndMod(self):
     mod = ModParser.parse("random 33".split(" "), self.attributes)
     self.assertEqual({"percentage": "33"}, mod.args)
     self.assertEqual("rnd", mod.method)
示例#7
0
 def testApplyRndMod(self):
     mod = ModParser.parse("random 100".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#8
0
 def testApplyIsModSuccessSmallerOrEqualThan(self):
     mod = ModParser.parse("is x <= 3".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#9
0
 def testApplyIsModFailsBiggerThan(self):
     mod = ModParser.parse("is x > 3".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertFalse(result)
示例#10
0
 def testApplyIsModSuccessSmallerOrEqualThan(self):
     mod = ModParser.parse("is x <= 3".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#11
0
 def testApplyIsModSuccessBiggerThan(self):
     mod = ModParser.parse("is x > 2".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#12
0
 def testGetIsMod(self):
     mod = ModParser.parse("is x >= 3".split(" "), self.attributes)
     self.assertEqual({"attribute": "x", "comparison": ">=", "against": "3"}, mod.args)
     self.assertEqual("has_attribute", mod.method)
示例#13
0
 def testApplyHasModFails(self):
     mod = ModParser.parse("has a 3".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertFalse(result)
示例#14
0
 def testApplyHasModMultipleQuantity(self):
     mod = ModParser.parse("has a 2".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#15
0
 def testGetHasMod(self):
     mod = ModParser.parse("has a 12".split(" "), self.attributes)
     self.assertEqual({"item_type": "a", "amount": "12"}, mod.args)
     self.assertEqual("has_item", mod.method)
示例#16
0
 def testApplyIsModFailsSmallerEqualThan(self):
     mod = ModParser.parse("is x =< 2".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertFalse(result)
示例#17
0
 def testApplyIsModSuccessBiggerThan(self):
     mod = ModParser.parse("is x > 2".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertTrue(result)
示例#18
0
 def testApplyIsModFailsSmallerEqualThan(self):
     mod = ModParser.parse("is x =< 2".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertFalse(result)
示例#19
0
 def testApplyIsModFailsBiggerThan(self):
     mod = ModParser.parse("is x > 3".split(" "), self.attributes)
     result = mod.apply(self.story_cache)
     self.assertFalse(result)
示例#20
0
 def testGetRndMod(self):
     mod = ModParser.parse("random 33".split(" "), self.attributes)
     self.assertEqual({"percentage": "33"}, mod.args)
     self.assertEqual("rnd", mod.method)