Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Kernel tests #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 31 additions & 44 deletions test/test_xnelson_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,47 @@
# The full license is in the file LICENSE, distributed with this software.
#############################################################################

#############################################################################
# TODO fake test to replace with test below when nelson is available
# as a package (for CI)

import tempfile
import unittest
import jupyter_kernel_test

class TestFake(unittest.TestCase):

def test_fake(self):
pass

#############################################################################

#import tempfile
#import unittest
#import jupyter_kernel_test
class KernelTests(jupyter_kernel_test.KernelTests):

#class KernelTests(jupyter_kernel_test.KernelTests):
kernel_name = "xnelson"
language_name = "nelson"
file_extension = ".nelson"

#kernel_name = "xnelson"
#language_name = "nelson"
#file_extension = ".nelson"
completion_samples = [{"text": "a", "matches": {"addpath"}}]

#completion_samples = [{"text": "a", "matches": {"addpath"}}]
# Samples of code which generate a result value (ie, some text
# displayed as Out[n])
code_execute_result = [
{
'code': '6 * 7',
'result': 'ans =\n\n 42'
}
]

## Samples of code which generate a result value (ie, some text
## displayed as Out[n])
#code_execute_result = [
#{
#'code': '6 * 7',
#'result': 'ans =\n\n 42'
#}
#]
incomplete_code_samples = ["for("]

#incomplete_code_samples = ["for("]
def test_stderr(self):
self.flush_channels()
reply, output_msgs = self.execute_helper(code="a = ")
self.assertEqual(output_msgs[0]["msg_type"], "error")
self.assertEqual(output_msgs[0]["content"]["ename"], "Interpreter error")

#def test_stderr(self):
#self.flush_channels()
#reply, output_msgs = self.execute_helper(code="a = ")
#self.assertEqual(output_msgs[0]["msg_type"], "error")
#self.assertEqual(output_msgs[0]["content"]["ename"], "Interpreter error")

#############################################################################
############################################################################

#code_hello_world = "hello, world"
#code_page_something = "?"
#code_inspect_sample = "print"
code_hello_world = "hello, world"
code_page_something = "?"
code_inspect_sample = "print"

#def test_stdout(self):
#self.flush_channels()
#reply, output_msgs = self.execute_helper(code="hello, world")
#self.assertEqual(output_msgs[0]["msg_type"], "stream")
#self.assertEqual(output_msgs[0]["content"]["name"], "stdout")
#self.assertEqual(output_msgs[0]["content"]["text"], "hello, world")
def test_stdout(self):
self.flush_channels()
reply, output_msgs = self.execute_helper(code="hello, world")
self.assertEqual(output_msgs[0]["msg_type"], "stream")
self.assertEqual(output_msgs[0]["content"]["name"], "stdout")
self.assertEqual(output_msgs[0]["content"]["text"], "hello, world")

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