MCPcopy
hub / github.com/django/django / test_ipython

Method test_ipython

tests/shell/tests.py:147–158  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

145 self.assertEqual(stdout.getvalue().strip(), __version__)
146
147 def test_ipython(self):
148 cmd = shell.Command()
149 mock_ipython = mock.Mock(start_ipython=mock.MagicMock())
150 options = {"verbosity": 0, "no_imports": False}
151
152 with mock.patch.dict(sys.modules, {"IPython": mock_ipython}):
153 cmd.ipython(options)
154
155 self.assertEqual(
156 mock_ipython.start_ipython.mock_calls,
157 [mock.call(argv=[], user_ns=cmd.get_namespace(**options))],
158 )
159
160 @mock.patch("django.core.management.commands.shell.select.select") # [1]
161 @mock.patch.dict("sys.modules", {"IPython": None})

Callers

nothing calls this directly

Calls 4

ipythonMethod · 0.95
get_namespaceMethod · 0.95
dictMethod · 0.80
callMethod · 0.80

Tested by

no test coverage detected