Ejemplo n.º 1
0
 def should_separate_type_and_subtypes(self):
     options = dict(type='land,dryad')
     request = SearchRequest(options)
     subt = SearchFilter('subtype', keywords=[SearchKeyword('dryad', 'and')])
     type_ = SearchFilter('type', keywords=[SearchKeyword('land', 'and')])
     self.assertEqual(request.get_filters(), {'type':type_,
                                              'subtype': subt})
Ejemplo n.º 2
0
 def should_separate_type_and_subtypes(self):
     options = dict(type='land,dryad')
     request = SearchRequest(options)
     subt = SearchFilter('subtype', keywords=[SearchKeyword('dryad', 'and')])
     type_ = SearchFilter('type', keywords=[SearchKeyword('land', 'and')])
     self.assertEqual(request.get_filters(), {'type':type_,
                                              'subtype': subt})
Ejemplo n.º 3
0
 def should_separate_many_types_with_not_modifier(self):
     options = dict(type='legendary,artifact,!equipment,!creature')
     request = SearchRequest(options)
     type_keywords = [SearchKeyword('legendary', 'and'),
                      SearchKeyword('artifact', 'and'),
                      SearchKeyword('creature', 'not')]
     subtype_keywords = [SearchKeyword('equipment', 'not')]
     subt = SearchFilter('subtype', keywords=subtype_keywords)
     type_ = SearchFilter('type', keywords=type_keywords)
     self.assertEqual(request.get_filters(), [type_, subt])
Ejemplo n.º 4
0
 def should_separate_many_types_with_not_modifier(self):
     options = dict(type='legendary,artifact,!equipment,!creature')
     request = SearchRequest(options)
     type_keywords = [SearchKeyword('legendary', 'and'),
                      SearchKeyword('artifact', 'and'),
                      SearchKeyword('creature', 'not')]
     subtype_keywords = [SearchKeyword('equipment', 'not')]
     subt = SearchFilter('subtype', keywords=subtype_keywords)
     type_ = SearchFilter('type', keywords=type_keywords)
     self.assertEqual(request.get_filters(), {'type': type_,
                                              'subtype': subt})
Ejemplo n.º 5
0
 def should_allow_type_and_subtype_exclusion(self):
     request = SearchRequest({'type': 'dryad,creature'}, exclude_others=['type'])
     self.assertTrue(request.get_filters()[0].exclude_others)
     self.assertTrue(request.get_filters()[1].exclude_others)
Ejemplo n.º 6
0
 def should_allow_type_exclusion(self):
     request = SearchRequest({'type': 'elemental'}, exclude_others=['type'])
     self.assertTrue(request.get_filters()[0].exclude_others)
Ejemplo n.º 7
0
 def should_allow_color_exclusion(self):
     request = SearchRequest({'color': 'wu'}, exclude_others=['color'])
     self.assertTrue(request.get_filters()[0].exclude_others)
Ejemplo n.º 8
0
 def should_recognize_creature_type_as_subtype(self):
     options = dict(type='dryad')
     request = SearchRequest(options)
     fl = SearchFilter('subtype', keywords=[SearchKeyword('dryad', 'and')])
     self.assertEqual(request.get_filters(), [fl])
Ejemplo n.º 9
0
 def should_allow_type_and_subtype_exclusion(self):
     request = SearchRequest({'type': 'dryad,creature'}, exclude_others=['type'])
     self.assertTrue(request.get_filters()['type'].exclude_others)
     self.assertTrue(request.get_filters()['subtype'].exclude_others)
Ejemplo n.º 10
0
 def should_allow_type_exclusion(self):
     request = SearchRequest({'type': 'elemental'}, exclude_others=['type'])
     self.assertTrue(request.get_filters()['subtype'].exclude_others)
Ejemplo n.º 11
0
 def should_allow_color_exclusion(self):
     request = SearchRequest({'color': 'wu'}, exclude_others=['color'])
     self.assertTrue(request.get_filters()['color'].exclude_others)
Ejemplo n.º 12
0
 def should_recognize_creature_type_as_subtype(self):
     options = dict(type='dryad')
     request = SearchRequest(options)
     fl = SearchFilter('subtype', keywords=[SearchKeyword('dryad', 'and')])
     self.assertEqual(request.get_filters(), {'subtype': fl})