@@ -34,7 +34,10 @@ def test_codecomplete(self) -> None:
3434 reply = self .get_non_kernel_info_reply (timeout = 1 )
3535 assert reply is not None
3636 self .assertEqual (reply ["msg_type" ], "complete_reply" )
37- self .assertEqual (str (reply ["content" ]["matches" ]), "['float', 'foo']" )
37+ if platform .system () == 'Windows' :
38+ self .assertEqual (str (reply ["content" ]["matches" ]), "['fabs', 'fabsf', 'fabsl', 'float', 'foo']" )
39+ else :
40+ self .assertEqual (str (reply ["content" ]["matches" ]), "['float', 'foo']" )
3841 self .assertEqual (reply ["content" ]["status" ], "ok" )
3942
4043 # Continuation
@@ -64,69 +67,70 @@ def test_continuation(self) -> None:
6467 self .assertEqual (reply ["content" ]["status" ], "complete" )
6568
6669
67- class XCppTests (jupyter_kernel_test .KernelTests ):
68-
69- kernel_name = 'xcpp20'
70-
71- # language_info.name in a kernel_info_reply should match this
72- language_name = 'C++'
73-
74- # Code that should write the exact string `hello, world` to STDOUT
75- code_hello_world = '#include <iostream>\n std::cout << "hello, world" << std::endl;'
76-
77- # Code that should cause (any) text to be written to STDERR
78- code_stderr = '#include <iostream>\n std::cerr << "oops" << std::endl;'
79-
80- # Pager: code that should display something (anything) in the pager
81- code_page_something = "?std::vector"
82-
83- # Exception throwing
84- # TODO: Remove 'if' when test work on MacOS/arm64. Throw Exceptions make
85- # kernel/test non-workable.
86- ###code_generate_error = 'throw std::runtime_error("Unknown exception");' if platform.system() != "Darwin" or platform.processor() != 'arm' else ''
87-
88- # Samples of code which generate a result value (ie, some text
89- # displayed as Out[n])
90- #code_execute_result = [
91- # {
92- # 'code': '6 * 7',
93- # 'result': '42'
94- # }
95- #]
96-
97- # Samples of code which should generate a rich display output, and
98- # the expected MIME type
99- code_display_data = [
100- {
101- 'code' : '#include <string>\n #include "xcpp/xdisplay.hpp"\n std::string test("foobar");\n xcpp::display(test);' ,
102- 'mime' : 'text/plain'
103- },
104- {
105- 'code' : """
106- #include <string>
107- #include <fstream>
108- #include "nlohmann/json.hpp"
109- #include "xtl/xbase64.hpp"
110- namespace im {
111- struct image {
112- inline image(const std::string& filename) {
113- std::ifstream fin(filename, std::ios::binary);
114- m_buffer << fin.rdbuf();
115- }
116- std::stringstream m_buffer;
117- };
118- nlohmann::json mime_bundle_repr(const image& i) {
119- auto bundle = nlohmann::json::object();
120- bundle["image/png"] = xtl::base64encode(i.m_buffer.str());
121- return bundle;
122- }
123- }
124- #include "xcpp/xdisplay.hpp"
125- im::image marie("../notebooks/images/marie.png");
126- xcpp::display(marie);""" ,
127- 'mime' : 'image/png'
70+ if platform .system () != 'Windows' :
71+ class XCppTests (jupyter_kernel_test .KernelTests ):
72+
73+ kernel_name = 'xcpp20'
74+
75+ # language_info.name in a kernel_info_reply should match this
76+ language_name = 'C++'
77+
78+ # Code that should write the exact string `hello, world` to STDOUT
79+ code_hello_world = '#include <iostream>\n std::cout << "hello, world" << std::endl;'
80+
81+ # Code that should cause (any) text to be written to STDERR
82+ code_stderr = '#include <iostream>\n std::cerr << "oops" << std::endl;'
83+
84+ # Pager: code that should display something (anything) in the pager
85+ code_page_something = "?std::vector"
86+
87+ # Exception throwing
88+ # TODO: Remove 'if' when test work on MacOS/arm64. Throw Exceptions make
89+ # kernel/test non-workable.
90+ ###code_generate_error = 'throw std::runtime_error("Unknown exception");' if platform.system() != "Darwin" or platform.processor() != 'arm' else ''
91+
92+ # Samples of code which generate a result value (ie, some text
93+ # displayed as Out[n])
94+ #code_execute_result = [
95+ # {
96+ # 'code': '6 * 7',
97+ # 'result': '42'
98+ # }
99+ #]
100+
101+ # Samples of code which should generate a rich display output, and
102+ # the expected MIME type
103+ code_display_data = [
104+ {
105+ 'code' : '#include <string>\n #include "xcpp/xdisplay.hpp"\n std::string test("foobar");\n xcpp::display(test);' ,
106+ 'mime' : 'text/plain'
107+ },
108+ {
109+ 'code' : """
110+ #include <string>
111+ #include <fstream>
112+ #include "nlohmann/json.hpp"
113+ #include "xtl/xbase64.hpp"
114+ namespace im {
115+ struct image {
116+ inline image(const std::string& filename) {
117+ std::ifstream fin(filename, std::ios::binary);
118+ m_buffer << fin.rdbuf();
128119 }
129- ]
120+ std::stringstream m_buffer;
121+ };
122+ nlohmann::json mime_bundle_repr(const image& i) {
123+ auto bundle = nlohmann::json::object();
124+ bundle["image/png"] = xtl::base64encode(i.m_buffer.str());
125+ return bundle;
126+ }
127+ }
128+ #include "xcpp/xdisplay.hpp"
129+ im::image marie("../notebooks/images/marie.png");
130+ xcpp::display(marie);""" ,
131+ 'mime' : 'image/png'
132+ }
133+ ]
130134
131135
132136class XCppTests2 (jupyter_kernel_test .KernelTests ):
@@ -141,4 +145,4 @@ class XCppTests2(jupyter_kernel_test.KernelTests):
141145
142146
143147if __name__ == '__main__' :
144- unittest .main ()
148+ unittest .main ()
0 commit comments