Show More
@@ -1708,8 +1708,6 b' class IPCompleter(Completer):' | |||
|
1708 | 1708 | u"""Match Latex syntax for unicode characters. |
|
1709 | 1709 | |
|
1710 | 1710 | This does both ``\\alp`` -> ``\\alpha`` and ``\\alpha`` -> ``α`` |
|
1711 | ||
|
1712 | Used on Python 3 only. | |
|
1713 | 1711 | """ |
|
1714 | 1712 | slashpos = text.rfind('\\') |
|
1715 | 1713 | if slashpos > -1: |
@@ -1722,7 +1720,8 b' class IPCompleter(Completer):' | |||
|
1722 | 1720 | # If a user has partially typed a latex symbol, give them |
|
1723 | 1721 | # a full list of options \al -> [\aleph, \alpha] |
|
1724 | 1722 | matches = [k for k in latex_symbols if k.startswith(s)] |
|
1725 |
|
|
|
1723 | if matches: | |
|
1724 | return s, matches | |
|
1726 | 1725 | return u'', [] |
|
1727 | 1726 | |
|
1728 | 1727 | def dispatch_custom_completer(self, text): |
@@ -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