MCPcopy Index your code
hub / github.com/ipython/ipython / test_omit__names

Method test_omit__names

tests/test_completer.py:704–763  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

702 )
703
704 def test_omit__names(self):
705 # also happens to test IPCompleter as a configurable
706 ip = get_ipython()
707 ip._hidden_attr = 1
708 ip._x = {}
709 c = ip.Completer
710 ip.ex("ip=get_ipython()")
711 cfg = Config()
712 cfg.IPCompleter.omit__names = 0
713 c.update_config(cfg)
714 with provisionalcompleter():
715 c.use_jedi = False
716 s, matches = c.complete("ip.")
717 self.assertIn(".__str__", matches)
718 self.assertIn("._hidden_attr", matches)
719
720 # c.use_jedi = True
721 # completions = set(c.completions('ip.', 3))
722 # self.assertIn(Completion(3, 3, '__str__'), completions)
723 # self.assertIn(Completion(3,3, "_hidden_attr"), completions)
724
725 cfg = Config()
726 cfg.IPCompleter.omit__names = 1
727 c.update_config(cfg)
728 with provisionalcompleter():
729 c.use_jedi = False
730 s, matches = c.complete("ip.")
731 self.assertNotIn(".__str__", matches)
732 # self.assertIn('ip._hidden_attr', matches)
733
734 # c.use_jedi = True
735 # completions = set(c.completions('ip.', 3))
736 # self.assertNotIn(Completion(3,3,'__str__'), completions)
737 # self.assertIn(Completion(3,3, "_hidden_attr"), completions)
738
739 cfg = Config()
740 cfg.IPCompleter.omit__names = 2
741 c.update_config(cfg)
742 with provisionalcompleter():
743 c.use_jedi = False
744 s, matches = c.complete("ip.")
745 self.assertNotIn(".__str__", matches)
746 self.assertNotIn("._hidden_attr", matches)
747
748 # c.use_jedi = True
749 # completions = set(c.completions('ip.', 3))
750 # self.assertNotIn(Completion(3,3,'__str__'), completions)
751 # self.assertNotIn(Completion(3,3, "_hidden_attr"), completions)
752
753 with provisionalcompleter():
754 c.use_jedi = False
755 s, matches = c.complete("ip._x.")
756 self.assertIn(".keys", matches)
757
758 # c.use_jedi = True
759 # completions = set(c.completions('ip._x.', 6))
760 # self.assertIn(Completion(6,6, "keys"), completions)
761

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