本文整理匯總了Python中workflow.workflow.Workflow.dumbify_punctuation方法的典型用法代碼示例。如果您正苦於以下問題:Python Workflow.dumbify_punctuation方法的具體用法?Python Workflow.dumbify_punctuation怎麽用?Python Workflow.dumbify_punctuation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類workflow.workflow.Workflow
的用法示例。
在下文中一共展示了Workflow.dumbify_punctuation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: WorkflowTests
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import dumbify_punctuation [as 別名]
#.........這裏部分代碼省略.........
results = self.wf.filter('lager', data, key)
self.assertEquals(len(results), 0)
def test_filter_empty_query_words(self):
"""Filter: empty query returns all results"""
data = ['bob', 'sue', 'henry']
self.assertEquals(self.wf.filter(' ', data), data)
self.assertEquals(self.wf.filter('', data), data)
def test_filter_empty_query_words_ignored(self):
"""Filter: empty query words ignored"""
data = ['bob jones', 'sue smith', 'henry rogers']
results = self.wf.filter('bob jones', data)
self.assertEquals(len(results), 1)
def test_filter_identical_items(self):
"""Filter: identical items are not discarded"""
data = ['bob', 'bob', 'bob']
results = self.wf.filter('bob', data)
self.assertEquals(len(results), len(data))
def test_filter_reversed_results(self):
"""Filter: results reversed"""
data = ['bob', 'bobby', 'bobby smith']
results = self.wf.filter('bob', data)
self.assertEquals(results, data)
results = self.wf.filter('bob', data, ascending=True)
self.assertEquals(results, data[::-1])
def test_punctuation(self):
"""Punctuation: dumbified"""
for input, output in self.punctuation_data:
self.assertEqual(self.wf.dumbify_punctuation(input), output)
def test_icons(self):
"""Icons"""
import workflow
for name in dir(workflow):
if name.startswith('ICON_'):
path = getattr(workflow, name)
print(name, path)
self.assert_(os.path.exists(path))
####################################################################
# Unicode properties
####################################################################
def test_datadir_is_unicode(self):
"""Workflow.datadir returns Unicode"""
wf = Workflow()
self.assertTrue(isinstance(wf.datadir, unicode))
self._teardown_env()
wf = Workflow()
self.assertTrue(isinstance(wf.datadir, unicode))
def test_datafile_is_unicode(self):
"""Workflow.datafile returns Unicode"""
wf = Workflow()
self.assertTrue(isinstance(wf.datafile(b'test.txt'), unicode))
self.assertTrue(isinstance(wf.datafile('über.txt'), unicode))
self._teardown_env()
wf = Workflow()
self.assertTrue(isinstance(wf.datafile(b'test.txt'), unicode))
self.assertTrue(isinstance(wf.datafile('über.txt'), unicode))