예제 #1
0
def test_latex_completions():
    from IPython.core.latex_symbols import latex_symbols
    import random
    ip = get_ipython()
    # Test some random unicode symbols
    keys = random.sample(latex_symbols.keys(), 10)
    for k in keys:
        text, matches = ip.complete(k)
        nt.assert_equal(len(matches),1)
        nt.assert_equal(text, k)
        nt.assert_equal(matches[0], latex_symbols[k])
    # Test a more complex line
    text, matches = ip.complete(u'print(\\alpha')
    nt.assert_equals(text, u'\\alpha')
    nt.assert_equals(matches[0], latex_symbols['\\alpha'])
    # Test multiple matching latex symbols
    text, matches = ip.complete(u'\\al')
    nt.assert_in('\\alpha', matches)
    nt.assert_in('\\aleph', matches)
예제 #2
0
    def test_latex_completions(self):
        from IPython.core.latex_symbols import latex_symbols
        import random

        ip = get_ipython()
        # Test some random unicode symbols
        keys = random.sample(latex_symbols.keys(), 10)
        for k in keys:
            text, matches = ip.complete(k)
            nt.assert_equal(text, k)
            nt.assert_equal(matches, [latex_symbols[k]])
        # Test a more complex line
        text, matches = ip.complete("print(\\alpha")
        nt.assert_equal(text, "\\alpha")
        nt.assert_equal(matches[0], latex_symbols["\\alpha"])
        # Test multiple matching latex symbols
        text, matches = ip.complete("\\al")
        nt.assert_in("\\alpha", matches)
        nt.assert_in("\\aleph", matches)