36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import unittest
|
|
from collections.abc import Callable
|
|
from typing import Any
|
|
|
|
from IPython.core.interactiveshell import InteractiveShell
|
|
|
|
from ipython_demo.shell import Shell
|
|
|
|
|
|
class TestMyIdeas(unittest.TestCase):
|
|
def test_MY_two_instances(self):
|
|
InteractiveShell1 = Shell("InteractiveShell1").init_shell()
|
|
InteractiveShell2 = Shell("InteractiveShell2").init_shell()
|
|
|
|
def ok[T](
|
|
resolve: Callable[[InteractiveShell], Any],
|
|
method: Callable[[T, T], Any],
|
|
) -> None:
|
|
t1 = resolve(InteractiveShell1)
|
|
t2 = resolve(InteractiveShell2)
|
|
method(t1, t2)
|
|
|
|
ok(
|
|
lambda shell: getattr(shell.history_manager, "outputs", None),
|
|
self.assertIsNot,
|
|
)
|
|
ok(lambda shell: shell.display_formatter, self.assertIsNot)
|
|
ok(lambda shell: shell.display_pub, self.assertIsNot)
|
|
ok(lambda shell: shell.displayhook, self.assertIsNot)
|
|
ok(lambda shell: shell.history_manager, self.assertIsNot)
|
|
ok(lambda shell: shell.user_ns, self.assertIsNot)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|