MCPcopy Create free account
hub / github.com/ipython/ipython / test_omit__names

Method test_omit__names

IPython/core/tests/test_completer.py:499–558  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

497 )
498
499 def test_omit__names(self):
500 # also happens to test IPCompleter as a configurable
501 ip = get_ipython()
502 ip._hidden_attr = 1
503 ip._x = {}
504 c = ip.Completer
505 ip.ex("ip=get_ipython()")
506 cfg = Config()
507 cfg.IPCompleter.omit__names = 0
508 c.update_config(cfg)
509 with provisionalcompleter():
510 c.use_jedi = False
511 s, matches = c.complete("ip.")
512 nt.assert_in("ip.__str__", matches)
513 nt.assert_in("ip._hidden_attr", matches)
514
515 # c.use_jedi = True
516 # completions = set(c.completions('ip.', 3))
517 # nt.assert_in(Completion(3, 3, '__str__'), completions)
518 # nt.assert_in(Completion(3,3, "_hidden_attr"), completions)
519
520 cfg = Config()
521 cfg.IPCompleter.omit__names = 1
522 c.update_config(cfg)
523 with provisionalcompleter():
524 c.use_jedi = False
525 s, matches = c.complete("ip.")
526 nt.assert_not_in("ip.__str__", matches)
527 # nt.assert_in('ip._hidden_attr', matches)
528
529 # c.use_jedi = True
530 # completions = set(c.completions('ip.', 3))
531 # nt.assert_not_in(Completion(3,3,'__str__'), completions)
532 # nt.assert_in(Completion(3,3, "_hidden_attr"), completions)
533
534 cfg = Config()
535 cfg.IPCompleter.omit__names = 2
536 c.update_config(cfg)
537 with provisionalcompleter():
538 c.use_jedi = False
539 s, matches = c.complete("ip.")
540 nt.assert_not_in("ip.__str__", matches)
541 nt.assert_not_in("ip._hidden_attr", matches)
542
543 # c.use_jedi = True
544 # completions = set(c.completions('ip.', 3))
545 # nt.assert_not_in(Completion(3,3,'__str__'), completions)
546 # nt.assert_not_in(Completion(3,3, "_hidden_attr"), completions)
547
548 with provisionalcompleter():
549 c.use_jedi = False
550 s, matches = c.complete("ip._x.")
551 nt.assert_in("ip._x.keys", matches)
552
553 # c.use_jedi = True
554 # completions = set(c.completions('ip._x.', 6))
555 # nt.assert_in(Completion(6,6, "keys"), completions)
556

Callers

nothing calls this directly

Calls 4

get_ipythonFunction · 0.90
provisionalcompleterFunction · 0.90
exMethod · 0.80
completeMethod · 0.45

Tested by

no test coverage detected