コード例 #1
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_understand_multiple_conditionals(self):
     parser = ConditionParser({'power': '<5,>0'})
     cond = parser.get_conditions()
     assert cond[0].name == 'power'
     self.assertEqual(cond[0].keywords, [SearchKeyword(5, 'and', '<'),
                                         SearchKeyword(0, 'and', '>')])
コード例 #2
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_understand_equality_conditional(self):
     parser = ConditionParser({'tough': '=3'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword(3, 'and', '=')])
コード例 #3
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def setUp(self):
     parser = ConditionParser({'text': 'trample'})
     self.conditions = parser.get_conditions()
コード例 #4
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_assume_equality_conditional(self):
     parser = ConditionParser({'cmc': '5'})
     cond = parser.get_conditions()
     assert cond[0].name == 'cmc'
     self.assertEqual(cond[0].keywords, [SearchKeyword(5, 'and', '=')])
コード例 #5
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_correctly_combine_not_and_and(self):
     parser = ConditionParser({'color': '!b,r'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword('B', 'not'),
                                         SearchKeyword('R', 'and')])
コード例 #6
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_accept_complete_words(self):
     parser = ConditionParser({'rarity': 'special'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword('S', 'and')])
コード例 #7
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def setUp(self):
     parser = ConditionParser({'text': 'first strike'})
     self.keywords = parser.get_conditions()['text'].keywords
コード例 #8
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_assume_and_when_comma_separated(self):
     parser = ConditionParser({'color': 'w,u,g'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword('W', 'and'),
                                         SearchKeyword('U', 'and'),
                                         SearchKeyword('G', 'and')])
コード例 #9
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_upcase_keyword(self):
     parser = ConditionParser({'rarity': 's'})
     cond = parser.get_conditions()
     self.assertEqual(cond['rarity'].keywords, [SearchKeyword('S', 'and')])
コード例 #10
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_accept_complete_words(self):
     parser = ConditionParser({'rarity': 'special'})
     cond = parser.get_conditions()
     self.assertEqual(cond['rarity'].keywords, [SearchKeyword('S', 'and')])
コード例 #11
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_convert_wedge_to_colors(self):
     parser = ConditionParser({'color': 'sultai'})
     cond = parser.get_conditions()
     self.assertEqual(cond['color'].keywords, [SearchKeyword('B', 'and'),
                                               SearchKeyword('G', 'and'),
                                               SearchKeyword('U', 'and')])
コード例 #12
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_convert_shard_to_colors(self):
     parser = ConditionParser({'color': 'grixis'})
     cond = parser.get_conditions()
     self.assertEqual(cond['color'].keywords, [SearchKeyword('B', 'and'),
                                               SearchKeyword('R', 'and'),
                                               SearchKeyword('U', 'and')])
コード例 #13
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_correctly_combine_not_and_and(self):
     parser = ConditionParser({'color': '!b,r'})
     cond = parser.get_conditions()
     self.assertEqual(cond['color'].keywords, [SearchKeyword('B', 'not'),
                                               SearchKeyword('R', 'and')])
コード例 #14
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_assume_and_when_adjacent(self):
     parser = ConditionParser({'color': 'wbg'})
     cond = parser.get_conditions()
     self.assertEqual(cond['color'].keywords, [SearchKeyword('W', 'and'),
                                               SearchKeyword('B', 'and'),
                                               SearchKeyword('G', 'and')])
コード例 #15
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def setUp(self):
     parser = ConditionParser({'text': 'trample'})
     self.conditions = parser.get_conditions()
コード例 #16
0
ファイル: test_gatherer_request.py プロジェクト: dekoza/mtg
 def should_convert_shard_to_colors(self):
     parser = ConditionParser({'color': 'grixis'})
     cond = parser.get_conditions()
     self.assertEqual(cond['color'].keywords, [SearchKeyword('B', 'and'),
                                               SearchKeyword('R', 'and'),
                                               SearchKeyword('U', 'and')])
コード例 #17
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def setUp(self):
     parser = ConditionParser({'text': 'exile,graveyard'})
     self.conditions = parser.get_conditions()
コード例 #18
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_assume_and_when_adjacent(self):
     parser = ConditionParser({'color': 'wbg'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword('W', 'and'),
                                         SearchKeyword('B', 'and'),
                                         SearchKeyword('G', 'and')])
コード例 #19
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_assume_equality_conditional(self):
     parser = ConditionParser({'cmc': '5'})
     cond = parser.get_conditions()
     assert cond['cmc'].name == 'cmc'
     self.assertEqual(cond['cmc'].keywords, [SearchKeyword(5, 'and', '=')])
コード例 #20
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_upcase_keyword(self):
     parser = ConditionParser({'rarity': 's'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword('S', 'and')])
コード例 #21
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_understand_less_than_conditional(self):
     parser = ConditionParser({'power': '<5'})
     cond = parser.get_conditions()
     assert cond['power'].name == 'power'
     self.assertEqual(cond['power'].keywords, [SearchKeyword(5, 'and', '<')])
コード例 #22
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def setUp(self):
     parser = ConditionParser({'text': 'first strike'})
     self.keywords = parser.get_conditions()[0].keywords
コード例 #23
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_understand_multiple_conditionals(self):
     parser = ConditionParser({'power': '<5,>0'})
     cond = parser.get_conditions()
     assert cond['power'].name == 'power'
     self.assertEqual(cond['power'].keywords, [SearchKeyword(5, 'and', '<'),
                                               SearchKeyword(0, 'and', '>')])
コード例 #24
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def setUp(self):
     parser = ConditionParser({'text': 'exile,graveyard'})
     self.conditions = parser.get_conditions()
コード例 #25
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_understand_greater_than_conditional(self):
     parser = ConditionParser({'tough': '>3'})
     cond = parser.get_conditions()
     self.assertEqual(cond['tough'].keywords, [SearchKeyword(3, 'and', '>')])
コード例 #26
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_understand_less_than_conditional(self):
     parser = ConditionParser({'power': '<5'})
     cond = parser.get_conditions()
     assert cond[0].name == 'power'
     self.assertEqual(cond[0].keywords, [SearchKeyword(5, 'and', '<')])
コード例 #27
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_understand_equality_conditional(self):
     parser = ConditionParser({'tough': '=3'})
     cond = parser.get_conditions()
     self.assertEqual(cond['tough'].keywords, [SearchKeyword(3, 'and', '=')])
コード例 #28
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_understand_greater_than_conditional(self):
     parser = ConditionParser({'tough': '>3'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword(3, 'and', '>')])
コード例 #29
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_understand_less_than_or_equal_to(self):
     parser = ConditionParser({'tough': '<=3'})
     cond = parser.get_conditions()
     self.assertEqual(cond['tough'].keywords, [SearchKeyword(3, 'and', '<=')])
コード例 #30
0
ファイル: test_gatherer_request.py プロジェクト: Miserlou/mtg
 def should_understand_less_than_or_equal_to(self):
     parser = ConditionParser({'tough': '<=3'})
     cond = parser.get_conditions()
     self.assertEqual(cond[0].keywords, [SearchKeyword(3, 'and', '<=')])
コード例 #31
0
ファイル: test_gatherer_request.py プロジェクト: two-jays/mtg
 def should_assume_and_when_comma_separated(self):
     parser = ConditionParser({'color': 'w,u,g'})
     cond = parser.get_conditions()
     self.assertEqual(cond['color'].keywords, [SearchKeyword('W', 'and'),
                                               SearchKeyword('U', 'and'),
                                               SearchKeyword('G', 'and')])