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})
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})
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])
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})
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)
def should_allow_type_exclusion(self): request = SearchRequest({'type': 'elemental'}, exclude_others=['type']) self.assertTrue(request.get_filters()[0].exclude_others)
def should_allow_color_exclusion(self): request = SearchRequest({'color': 'wu'}, exclude_others=['color']) self.assertTrue(request.get_filters()[0].exclude_others)
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])
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)
def should_allow_type_exclusion(self): request = SearchRequest({'type': 'elemental'}, exclude_others=['type']) self.assertTrue(request.get_filters()['subtype'].exclude_others)
def should_allow_color_exclusion(self): request = SearchRequest({'color': 'wu'}, exclude_others=['color']) self.assertTrue(request.get_filters()['color'].exclude_others)
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})