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

Method test_env_secret

IPython/core/tests/test_magic.py:752–768  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

750 self.assertTrue(isinstance(env, dict))
751
752 def test_env_secret(self):
753 env = _ip.magic("env")
754 hidden = "<hidden>"
755 with mock.patch.dict(
756 os.environ,
757 {
758 "API_KEY": "abc123",
759 "SECRET_THING": "ssshhh",
760 "JUPYTER_TOKEN": "",
761 "VAR": "abc"
762 }
763 ):
764 env = _ip.magic("env")
765 assert env["API_KEY"] == hidden
766 assert env["SECRET_THING"] == hidden
767 assert env["JUPYTER_TOKEN"] == hidden
768 assert env["VAR"] == "abc"
769
770 def test_env_get_set_simple(self):
771 env = _ip.magic("env var val1")

Callers

nothing calls this directly

Calls 2

dictMethod · 0.80
magicMethod · 0.45

Tested by

no test coverage detected