def test_normalize(self, app): assert normalize('') == '' assert normalize('a') == '' assert normalize('aa') == '' assert normalize('aaa') == 'aaa' assert normalize('a' * (MAX_TAG_LENGTH + 1)) == 'a' * MAX_TAG_LENGTH assert normalize('aAa a') == 'aaa-a'
def test_normalize(self, app): assert normalize('') == '' assert normalize('a') == '' assert normalize('aa') == '' assert normalize('aaa') == 'aaa' assert normalize('a' * (MAX_TAG_LENGTH + 1)) == 'a' * MAX_TAG_LENGTH assert normalize('aAa a') == 'aaa-a'
def test_normalize(self): self.assertEquals('', normalize('')) self.assertEquals('', normalize('a')) self.assertEquals('', normalize('aa')) self.assertEquals('aaa', normalize('aaa')) self.assertEquals('a' * MAX_TAG_LENGTH, normalize('a' * (MAX_TAG_LENGTH + 1))) self.assertEquals('aaa-a', normalize('aAa a'))
def normalize_tag(value): return tags.normalize(value)
def get(self): '''Suggest tags''' args = parser.parse_args() q = normalize(args['q']) result = search.suggest(q, 'tag_suggest', args['size']) return sorted(result, key=lambda o: len(o['text']))
def get(self): '''Suggest tags''' args = parser.parse_args() q = normalize(args['q']) result = search.suggest(q, 'tag_suggest', args['size']) return sorted(result, key=lambda o: len(o['text']))
def normalize_tag(value): return tags.normalize(value)