test_completer.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:leetcode 作者: thomasyimgit 项目源码 文件源码
def test_dict_key_completion_unicode_py3():
    """Test handling of unicode in dict key completion"""
    ip = get_ipython()
    complete = ip.Completer.complete

    ip.user_ns['d'] = {u'a\u05d0': None}

    # query using escape
    if sys.platform != 'win32':
        # Known failure on Windows
        _, matches = complete(line_buffer="d['a\\u05d0")
        nt.assert_in("u05d0", matches)  # tokenized after \\

    # query using character
    _, matches = complete(line_buffer="d['a\u05d0")
    nt.assert_in(u"a\u05d0", matches)

    with greedy_completion():
        # query using escape
        _, matches = complete(line_buffer="d['a\\u05d0")
        nt.assert_in("d['a\\u05d0']", matches)  # tokenized after \\

        # query using character
        _, matches = complete(line_buffer="d['a\u05d0")
        nt.assert_in(u"d['a\u05d0']", matches)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号