File: test_xeus_cling.py

package info (click to toggle)
jupyter-kernel-test 0.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 200 kB
  • sloc: python: 805; makefile: 7
file content (43 lines) | stat: -rw-r--r-- 1,162 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
A non-python example, with tests for xeus-cling kernel (https://github.com/jupyter-xeus/xeus-cling).
(Beware of python quoting/string escaping rules being different to the
language being tested)
"""

import unittest

from jupyter_client.kernelspec import NoSuchKernel

import jupyter_kernel_test as jkt


class XeusClingKernelTests(jkt.KernelTests):
    kernel_name = "xcpp17"

    @classmethod
    def setUpClass(cls):
        try:
            cls.km, cls.kc = jkt.start_new_kernel(kernel_name=cls.kernel_name)
        except NoSuchKernel:
            raise unittest.SkipTest("Xeus-Cling Kernel not installed") from None

    language_name = "c++"

    file_extension = ".cpp"

    code_hello_world = '#include <iostream>\nstd::cout << "hello, world!" << std::endl;'

    code_stderr = '#include <iostream>\nstd::cerr << "some error" << std::endl;'

    complete_code_samples = ["1", "int j=5"]
    incomplete_code_samples = ["double sqr(double a"]

    code_generate_error = 'throw std::runtime_error("Unknown exception");'

    code_execute_result = [
        {"code": "int j = 5;j", "result": "5"},
    ]


if __name__ == "__main__":
    unittest.main()