Show More
@@ -1699,8 +1699,6 b' class IPCompleter(Completer):' | |||
|
1699 | 1699 | u"""Match Latex syntax for unicode characters. |
|
1700 | 1700 | |
|
1701 | 1701 | This does both ``\\alp`` -> ``\\alpha`` and ``\\alpha`` -> ``α`` |
|
1702 | ||
|
1703 | Used on Python 3 only. | |
|
1704 | 1702 | """ |
|
1705 | 1703 | slashpos = text.rfind('\\') |
|
1706 | 1704 | if slashpos > -1: |
@@ -1713,6 +1711,7 b' class IPCompleter(Completer):' | |||
|
1713 | 1711 | # If a user has partially typed a latex symbol, give them |
|
1714 | 1712 | # a full list of options \al -> [\aleph, \alpha] |
|
1715 | 1713 | matches = [k for k in latex_symbols if k.startswith(s)] |
|
1714 | if matches: | |
|
1716 | 1715 | return s, matches |
|
1717 | 1716 | return u'', [] |
|
1718 | 1717 |
@@ -224,20 +224,27 b' class TestCompleter(unittest.TestCase):' | |||
|
224 | 224 | nt.assert_in("\\alpha", matches) |
|
225 | 225 | nt.assert_in("\\aleph", matches) |
|
226 | 226 | |
|
227 | def test_latex_no_results(self): | |
|
228 | """ | |
|
229 | forward latex should really return nothing in either field if nothing is found. | |
|
230 | """ | |
|
231 | ip = get_ipython() | |
|
232 | text, matches = ip.Completer.latex_matches("\\really_i_should_match_nothing") | |
|
233 | nt.assert_equal(text, "") | |
|
234 | nt.assert_equal(matches, []) | |
|
235 | ||
|
227 | 236 | def test_back_latex_completion(self): |
|
228 | 237 | ip = get_ipython() |
|
229 | 238 | |
|
230 | 239 | # do not return more than 1 matches fro \beta, only the latex one. |
|
231 | 240 | name, matches = ip.complete("\\β") |
|
232 |
nt.assert_equal( |
|
|
233 | nt.assert_equal(matches[0], "\\beta") | |
|
241 | nt.assert_equal(matches, ['\\beta']) | |
|
234 | 242 | |
|
235 | 243 | def test_back_unicode_completion(self): |
|
236 | 244 | ip = get_ipython() |
|
237 | 245 | |
|
238 | 246 | name, matches = ip.complete("\\Ⅴ") |
|
239 |
nt.assert_equal( |
|
|
240 | nt.assert_equal(matches[0], "\\ROMAN NUMERAL FIVE") | |
|
247 | nt.assert_equal(matches, ["\\ROMAN NUMERAL FIVE"]) | |
|
241 | 248 | |
|
242 | 249 | def test_forward_unicode_completion(self): |
|
243 | 250 | ip = get_ipython() |
General Comments 0
You need to be logged in to leave comments.
Login now