##// END OF EJS Templates
test_completer tests resurrection...
Nikita Kniazev -
Show More
@@ -34,7 +34,7 b' jobs:'
34 34 python -m pip install --upgrade pip setuptools wheel
35 35 python -m pip install --upgrade -e file://$PWD#egg=ipython[test]
36 36 python -m pip install --upgrade --upgrade-strategy eager trio curio
37 python -m pip install --upgrade pytest pytest-cov pytest-trio 'matplotlib!=3.2.0'
37 python -m pip install --upgrade pytest pytest-cov pytest-trio 'matplotlib!=3.2.0' pandas
38 38 python -m pip install --upgrade check-manifest pytest-cov anyio
39 39 - name: Check manifest
40 40 run: check-manifest
@@ -328,20 +328,18 b' class TestCompleter(unittest.TestCase):'
328 328 name, matches = ip.complete("\\" + letter)
329 329 self.assertEqual(matches, [])
330 330
331 class CompletionSplitterTestCase(unittest.TestCase):
332 def setUp(self):
333 self.sp = completer.CompletionSplitter()
334
335 def test_delim_setting(self):
336 self.sp.delims = " "
337 self.assertEqual(self.sp.delims, " ")
338 self.assertEqual(self.sp._delim_expr, r"[\ ]")
339
340 def test_spaces(self):
341 """Test with only spaces as split chars."""
342 self.sp.delims = " "
343 t = [("foo", "", "foo"), ("run foo", "", "foo"), ("run foo", "bar", "foo")]
344 check_line_split(self.sp, t)
331 def test_delim_setting(self):
332 sp = completer.CompletionSplitter()
333 sp.delims = " "
334 self.assertEqual(sp.delims, " ")
335 self.assertEqual(sp._delim_expr, r"[\ ]")
336
337 def test_spaces(self):
338 """Test with only spaces as split chars."""
339 sp = completer.CompletionSplitter()
340 sp.delims = " "
341 t = [("foo", "", "foo"), ("run foo", "", "foo"), ("run foo", "bar", "foo")]
342 check_line_split(sp, t)
345 343
346 344 def test_has_open_quotes1(self):
347 345 for s in ["'", "'''", "'hi' '"]:
@@ -462,7 +460,7 b' class TestCompleter(unittest.TestCase):'
462 460 ip.Completer.use_jedi = True
463 461 completions = set(ip.Completer.completions(s, l))
464 462 ip.Completer.use_jedi = False
465 assert_in(Completion(start, end, comp), completions, reason)
463 assert Completion(start, end, comp) in completions, reason
466 464
467 465 def _test_not_complete(reason, s, comp):
468 466 l = len(s)
@@ -470,18 +468,18 b' class TestCompleter(unittest.TestCase):'
470 468 ip.Completer.use_jedi = True
471 469 completions = set(ip.Completer.completions(s, l))
472 470 ip.Completer.use_jedi = False
473 assert_not_in(Completion(l, l, comp), completions, reason)
471 assert Completion(l, l, comp) not in completions, reason
474 472
475 473 import jedi
476 474
477 475 jedi_version = tuple(int(i) for i in jedi.__version__.split(".")[:3])
478 476 if jedi_version > (0, 10):
479 yield _test_complete, "jedi >0.9 should complete and not crash", "a=1;a.", "real"
480 yield _test_complete, "can infer first argument", 'a=(1,"foo");a[0].', "real"
481 yield _test_complete, "can infer second argument", 'a=(1,"foo");a[1].', "capitalize"
482 yield _test_complete, "cover duplicate completions", "im", "import", 0, 2
477 _test_complete("jedi >0.9 should complete and not crash", "a=1;a.", "real")
478 _test_complete("can infer first argument", 'a=(1,"foo");a[0].', "real")
479 _test_complete("can infer second argument", 'a=(1,"foo");a[1].', "capitalize")
480 _test_complete("cover duplicate completions", "im", "import", 0, 2)
483 481
484 yield _test_not_complete, "does not mix types", 'a=(1,"foo");a[0].', "capitalize"
482 _test_not_complete("does not mix types", 'a=(1,"foo");a[0].', "capitalize")
485 483
486 484 def test_completion_have_signature(self):
487 485 """
@@ -548,15 +546,27 b' class TestCompleter(unittest.TestCase):'
548 546 self.assertIn(completion, completions)
549 547
550 548 with provisionalcompleter():
551 yield _, "a[0].", 5, "a[0].real", "Should have completed on a[0].: %s", Completion(
552 5, 5, "real"
549 _(
550 "a[0].",
551 5,
552 "a[0].real",
553 "Should have completed on a[0].: %s",
554 Completion(5, 5, "real"),
553 555 )
554 yield _, "a[0].r", 6, "a[0].real", "Should have completed on a[0].r: %s", Completion(
555 5, 6, "real"
556 _(
557 "a[0].r",
558 6,
559 "a[0].real",
560 "Should have completed on a[0].r: %s",
561 Completion(5, 6, "real"),
556 562 )
557 563
558 yield _, "a[0].from_", 10, "a[0].from_bytes", "Should have completed on a[0].from_: %s", Completion(
559 5, 10, "from_bytes"
564 _(
565 "a[0].from_",
566 10,
567 "a[0].from_bytes",
568 "Should have completed on a[0].from_: %s",
569 Completion(5, 10, "from_bytes"),
560 570 )
561 571
562 572 def test_omit__names(self):
@@ -23,7 +23,7 b' init:'
23 23 install:
24 24 - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
25 25 - python -m pip install --upgrade setuptools pip
26 - pip install nose coverage pytest pytest-cov pytest-trio pywin32 matplotlib
26 - pip install nose coverage pytest pytest-cov pytest-trio pywin32 matplotlib pandas
27 27 - pip install .[test]
28 28 - mkdir results
29 29 - cd results
General Comments 0
You need to be logged in to leave comments. Login now