当前位置: 首页>>代码示例>>Python>>正文


Python filter_refs.get_result_list函数代码示例

本文整理汇总了Python中yvs.filter_refs.get_result_list函数的典型用法代码示例。如果您正苦于以下问题:Python get_result_list函数的具体用法?Python get_result_list怎么用?Python get_result_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_result_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_case

def test_case():
    """should match books irrespective of case"""
    query_str = 'Matthew'
    results = yvs.get_result_list(query_str)
    results_lower = yvs.get_result_list(query_str.lower())
    results_upper = yvs.get_result_list(query_str.upper())
    nose.assert_equal(len(results), 1)
    nose.assert_list_equal(results_lower, results)
    nose.assert_list_equal(results_upper, results)
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:9,代码来源:test_filter_refs_book.py

示例2: test_case

def test_case():
    """should match versions irrespective of case"""
    query = 'e 4:8 esv'
    results = yvs.get_result_list(query)
    results_lower = yvs.get_result_list(query.lower())
    results_upper = yvs.get_result_list(query.upper())
    nose.assert_list_equal(results_lower, results)
    nose.assert_list_equal(results_upper, results)
    nose.assert_equal(len(results), 6)
开发者ID:caleb531,项目名称:youversion-suggest,代码行数:9,代码来源:test_version.py

示例3: test_partial_ambiguous

def test_partial_ambiguous():
    """should match books by ambiguous partial name"""
    results = yvs.get_result_list('r')
    nose.assert_equal(len(results), 3)
    nose.assert_equal(results[0]['title'], 'Ruth 1 (NIV)')
    nose.assert_equal(results[1]['title'], 'Romans 1 (NIV)')
    nose.assert_equal(results[2]['title'], 'Revelation 1 (NIV)')
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:7,代码来源:test_filter_refs_book.py

示例4: test_output

def test_output(out):
    """should output ref result list JSON"""
    query_str = 'genesis 50:20'
    yvs.main(query_str)
    output = out.getvalue().rstrip()
    results = yvs.get_result_list(query_str)
    feedback = yvs.core.get_result_list_feedback_str(results).rstrip()
    nose.assert_equal(output, feedback)
开发者ID:caleb531,项目名称:youversion-suggest,代码行数:8,代码来源:test_main.py

示例5: test_output

def test_output(out):
    """should output ref result list XML"""
    query_str = 'genesis 50:20'
    yvs.main(query_str)
    output = out.getvalue().strip()
    results = yvs.get_result_list(query_str)
    xml = yvs.shared.get_result_list_xml(results).strip()
    nose.assert_equal(output, xml)
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:8,代码来源:test_filter_refs_main.py

示例6: test_nonnumbered_partial

def test_nonnumbered_partial():
    """should match numbered books by partial non-numbered name"""
    results = yvs.get_result_list('john')
    nose.assert_equal(len(results), 4)
    nose.assert_equal(results[0]['title'], 'John 1 (NIV)')
    nose.assert_equal(results[1]['title'], '1 John 1 (NIV)')
    nose.assert_equal(results[2]['title'], '2 John 1 (NIV)')
    nose.assert_equal(results[3]['title'], '3 John 1 (NIV)')
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:8,代码来源:test_filter_refs_book.py

示例7: test_numbered_nonnumbered_partial

def test_numbered_nonnumbered_partial():
    """should match numbered and non-numbered books by partial name"""
    results = yvs.get_result_list('c')
    nose.assert_equal(results[0]['title'], 'Colossians 1 (NIV)')
    nose.assert_equal(results[1]['title'], '1 Chronicles 1 (NIV)')
    nose.assert_equal(results[2]['title'], '2 Chronicles 1 (NIV)')
    nose.assert_equal(results[3]['title'], '1 Corinthians 1 (NIV)')
    nose.assert_equal(results[4]['title'], '2 Corinthians 1 (NIV)')
    nose.assert_equal(len(results), 5)
开发者ID:caleb531,项目名称:youversion-suggest,代码行数:9,代码来源:test_book.py

示例8: test_structure

def test_structure():
    """JSON should match result list"""
    results = yvs.get_result_list('matthew 6:34')
    result = results[0]
    feedback_str = yvs.core.get_result_list_feedback_str(results)
    feedback = json.loads(feedback_str)
    nose.assert_in('items', feedback, 'feedback object must have result items')
    item = feedback['items'][0]
    nose.assert_equal(item['uid'], result['uid'])
    nose.assert_equal(item['arg'], result['arg'])
    nose.assert_equal(
        item['quicklookurl'], 'https://www.bible.com/bible/111/MAT.6.34')
    nose.assert_equal(item['valid'], True)
    nose.assert_equal(item['title'], 'Matthew 6:34 (NIV)')
    nose.assert_equal(item['text']['copy'], result['title'])
    nose.assert_equal(item['text']['largetype'], result['title'])
    nose.assert_equal(item['subtitle'], result['subtitle'])
    nose.assert_equal(item['icon']['path'], 'icon.png')
开发者ID:caleb531,项目名称:youversion-suggest,代码行数:18,代码来源:test_feedback.py

示例9: test_structure

def test_structure():
    """XML should match result list"""
    results = yvs.get_result_list('matthew 6:34')
    result = results[0]
    xml = yvs.shared.get_result_list_xml(results)
    root = ET.fromstring(xml)
    nose.assert_equal(root.tag, 'items',
                      'root element must be named <items>')
    item = root.find('item')
    nose.assert_is_not_none(item, '<item> element is missing')
    nose.assert_equal(item.get('uid'), result['uid'])
    nose.assert_equal(item.get('arg'), result['arg'])
    nose.assert_equal(item.get('valid'), 'yes')
    title = item.find('title')
    nose.assert_is_not_none(title, '<title> element is missing')
    copy, largetype = item.findall('text')
    nose.assert_equal(copy.text, result['title'])
    nose.assert_equal(largetype.text, result['title'])
    subtitle = item.find('subtitle')
    nose.assert_is_not_none(subtitle, '<subtitle> element is missing')
    nose.assert_equal(subtitle.text, result['subtitle'])
    icon = item.find('icon')
    nose.assert_is_not_none(icon, '<icon> element is missing')
    nose.assert_equal(icon.text, 'icon.png')
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:24,代码来源:test_filter_refs_xml.py

示例10: test_non_ascii

def test_non_ascii():
    """should match versions containing non-ASCII characters"""
    results = yvs.get_result_list('路加 4:8 cunp-上')
    nose.assert_equal(results[0]['title'], '路加福音 4:8 (CUNP-上帝)')
    nose.assert_equal(len(results), 1)
开发者ID:caleb531,项目名称:youversion-suggest,代码行数:5,代码来源:test_version.py

示例11: test_id

def test_id():
    """should use correct ID for chapters"""
    results = yvs.get_result_list('luke 4')
    nose.assert_equal(results[0]['uid'], 'yvs-111/luk.4')
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:4,代码来源:test_filter_refs_chapter.py

示例12: test_version

def test_version():
    """should recognize shorthand version syntax"""
    results = yvs.get_result_list('1 co 13esv')
    nose.assert_equal(results[0]['title'], '1 Corinthians 13 (ESV)')
    nose.assert_equal(len(results), 1)
开发者ID:caleb531,项目名称:youversion-suggest,代码行数:5,代码来源:test_shorthand.py

示例13: test_numbered

def test_numbered():
    """should match versions ending in number by partial name"""
    results = yvs.get_result_list('lucas 4:8 rvr1')
    nose.assert_equal(results[0]['title'], 'Lucas 4:8 (RVR1960)')
    nose.assert_equal(len(results), 1)
开发者ID:caleb531,项目名称:youversion-suggest,代码行数:5,代码来源:test_version.py

示例14: test_unicode_normalization

def test_unicode_normalization():
    """should normalize Unicode characters"""
    results = yvs.get_result_list('e\u0301')
    nose.assert_equal(len(results), 0)
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:4,代码来源:test_filter_refs_edge.py

示例15: test_whitespace

def test_whitespace():
    """should ignore excessive whitespace"""
    results = yvs.get_result_list('  romans  8  28  a  ')
    nose.assert_equal(len(results), 1)
    nose.assert_equal(results[0]['title'], 'Romans 8:28 (AMP)')
开发者ID:bondezbond,项目名称:youversion-suggest,代码行数:5,代码来源:test_filter_refs_edge.py


注:本文中的yvs.filter_refs.get_result_list函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。