Commit 7ab3950c authored by Romain Casati's avatar Romain Casati
Browse files

Testing ipythonblocks.

parent 96090508
["Bio", "IPython", "PIL", "__future__", "__main__", "_abc", "_ast", "_bootlocale", "_codecs", "_collections", "_collections_abc", "_compat_pickle", "_compression", "_contextvars", "_dummy_thread", "_frozen_importlib", "_frozen_importlib_external", "_functools", "_heapq", "_imp", "_io", "_ivp", "_locale", "_markupbase", "_operator", "_posixsubprocess", "_py_abc", "_pydecimal", "_pyio", "_signal", "_sitebuiltins", "_socket", "_sre", "_stat", "_string", "_strptime", "_sysconfigdata__emscripten_", "_testcapi", "_thread", "_threading_local", "_warnings", "_weakref", "_weakrefset", "abc", "aifc", "antigravity", "argparse", "asciitree", "ast", "astropy", "asynchat", "asyncio", "asyncore", "atexit", "atomicwrites", "attr", "autograd", "bar", "base64", "basthon", "bdb", "binhex", "bisect", "bleach", "bs4", "builtins", "bz2", "cProfile", "calendar", "cgi", "cgitb", "chunk", "cloudpickle", "cmd", "code", "codecs", "codeop", "collections", "colorsys", "compileall", "concurrent", "configparser", "contextlib", "contextvars", "copy", "copyreg", "crypt", "cssselect", "csv", "cycler", "cytoolz", "dataclasses", "datetime", "dateutil", "decimal", "decorator", "difflib", "dis", "distlib", "distutils", "doctest", "docutils", "dummy_threading", "easy_install", "email", "encodings", "enum", "errno", "filecmp", "fileinput", "fnmatch", "folium", "foo", "formatter", "fractions", "freesasa", "ftplib", "functools", "future", "genericpath", "getopt", "getpass", "gettext", "glob", "graphviz", "gzip", "hashlib", "heapq", "hmac", "html", "html5lib", "http", "imageio", "imaplib", "imghdr", "imp", "importlib", "inspect", "io", "ipaddress", "itertools", "jedi", "jinja2", "joblib", "js", "json", "keyword", "kiwisolver", "linecache", "locale", "logging", "lxml", "lzma", "mailbox", "mailcap", "markupsafe", "marshal", "math", "matplotlib", "micropip", "mimetypes", "mne", "modulefinder", "more_itertools", "mpl_toolkits", "mpmath", "msgpack", "multiprocessing", "netrc", "networkx", "nltk", "nntplib", "nose", "ntpath", "nturl2path", "numbers", "numcodecs", "numpy", "opcode", "operator", "optparse", "os", "osmiter", "p5", "packaging", "pandas", "parso", "pathlib", "patsy", "pdb", "pickle", "pickletools", "pipes", "pkg_resources", "pkgutil", "platform", "plistlib", "pluggy", "poplib", "posix", "posixpath", "pprint", "profile", "proj4py", "pstats", "pty", "py", "py_compile", "pyclbr", "pydoc", "pydoc_data", "pygments", "pyodide", "pyodide_interrupts", "pyparsing", "pyroutelib3", "pysat", "pystone", "pytest", "pytz", "pywt", "qrcode", "queue", "quopri", "random", "re", "regex", "reprlib", "requests", "rlcompleter", "runpy", "sched", "scipy", "secrets", "select", "selectors", "setuptools", "shelve", "shlex", "shutil", "signal", "site", "sitecustomize", "six", "skimage", "sklearn", "smtpd", "smtplib", "sndhdr", "socket", "socketserver", "soupsieve", "sqlite3", "sre_compile", "sre_constants", "sre_parse", "ssl", "stat", "statistics", "statsmodels", "string", "stringprep", "struct", "subprocess", "sunau", "symbol", "sympy", "symtable", "sys", "sysconfig", "tabnanny", "tarfile", "telnetlib", "tempfile", "textwrap", "this", "threading", "time", "timeit", "token", "tokenize", "toolz", "trace", "traceback", "tracemalloc", "traits", "tty", "turtle", "tutor", "types", "typing", "uncertainties", "unittest", "urllib", "uu", "uuid", "warnings", "wave", "weakref", "webbrowser", "webencodings", "wsgiref", "xdrlib", "xlrd", "xml", "xmlrpc", "yt", "zarr", "zipapp", "zipfile", "zipimport"]
\ No newline at end of file
["Bio", "IPython", "PIL", "__future__", "__main__", "_abc", "_ast", "_bootlocale", "_codecs", "_collections", "_collections_abc", "_compat_pickle", "_compression", "_contextvars", "_dummy_thread", "_frozen_importlib", "_frozen_importlib_external", "_functools", "_heapq", "_imp", "_io", "_ivp", "_locale", "_markupbase", "_operator", "_posixsubprocess", "_py_abc", "_pydecimal", "_pyio", "_signal", "_sitebuiltins", "_socket", "_sre", "_stat", "_string", "_strptime", "_sysconfigdata__emscripten_", "_testcapi", "_thread", "_threading_local", "_warnings", "_weakref", "_weakrefset", "abc", "aifc", "antigravity", "argparse", "asciitree", "ast", "astropy", "asynchat", "asyncio", "asyncore", "atexit", "atomicwrites", "attr", "autograd", "bar", "base64", "basthon", "bdb", "binhex", "bisect", "bleach", "bs4", "builtins", "bz2", "cProfile", "calendar", "cgi", "cgitb", "chunk", "cloudpickle", "cmd", "code", "codecs", "codeop", "collections", "colorsys", "compileall", "concurrent", "configparser", "contextlib", "contextvars", "copy", "copyreg", "crypt", "cssselect", "csv", "cycler", "cytoolz", "dataclasses", "datetime", "dateutil", "decimal", "decorator", "difflib", "dis", "distlib", "distutils", "doctest", "docutils", "dummy_threading", "easy_install", "email", "encodings", "enum", "errno", "filecmp", "fileinput", "fnmatch", "folium", "foo", "formatter", "fractions", "freesasa", "ftplib", "functools", "future", "genericpath", "getopt", "getpass", "gettext", "glob", "graphviz", "gzip", "hashlib", "heapq", "hmac", "html", "html5lib", "http", "imageio", "imaplib", "imghdr", "imp", "importlib", "inspect", "io", "ipaddress", "ipythonblocks", "itertools", "jedi", "jinja2", "joblib", "js", "json", "keyword", "kiwisolver", "linecache", "locale", "logging", "lxml", "lzma", "mailbox", "mailcap", "markupsafe", "marshal", "math", "matplotlib", "micropip", "mimetypes", "mne", "modulefinder", "more_itertools", "mpl_toolkits", "mpmath", "msgpack", "multiprocessing", "netrc", "networkx", "nltk", "nntplib", "nose", "ntpath", "nturl2path", "numbers", "numcodecs", "numpy", "opcode", "operator", "optparse", "os", "osmiter", "p5", "packaging", "pandas", "parso", "pathlib", "patsy", "pdb", "pickle", "pickletools", "pipes", "pkg_resources", "pkgutil", "platform", "plistlib", "pluggy", "poplib", "posix", "posixpath", "pprint", "profile", "proj4py", "pstats", "pty", "py", "py_compile", "pyclbr", "pydoc", "pydoc_data", "pygments", "pyodide", "pyodide_interrupts", "pyparsing", "pyroutelib3", "pysat", "pystone", "pytest", "pytz", "pywt", "qrcode", "queue", "quopri", "random", "re", "regex", "reprlib", "requests", "rlcompleter", "runpy", "sched", "scipy", "secrets", "select", "selectors", "setuptools", "shelve", "shlex", "shutil", "signal", "site", "sitecustomize", "six", "skimage", "sklearn", "smtpd", "smtplib", "sndhdr", "socket", "socketserver", "soupsieve", "sqlite3", "sre_compile", "sre_constants", "sre_parse", "ssl", "stat", "statistics", "statsmodels", "string", "stringprep", "struct", "subprocess", "sunau", "symbol", "sympy", "symtable", "sys", "sysconfig", "tabnanny", "tarfile", "telnetlib", "tempfile", "textwrap", "this", "threading", "time", "timeit", "token", "tokenize", "toolz", "trace", "traceback", "tracemalloc", "traits", "tty", "turtle", "tutor", "types", "typing", "uncertainties", "unittest", "urllib", "uu", "uuid", "warnings", "wave", "weakref", "webbrowser", "webencodings", "wsgiref", "xdrlib", "xlrd", "xml", "xmlrpc", "yt", "zarr", "zipapp", "zipfile", "zipimport"]
\ No newline at end of file
# width height
10 10
# block size
4
# initial color
0 0 0
# row column red green blue
0 0 255 255 0
0 1 230 255 26
0 2 204 255 51
0 3 178 255 76
0 4 153 255 102
0 5 128 255 128
0 6 102 255 153
0 7 76 255 178
0 8 51 255 204
0 9 26 255 230
1 0 255 230 0
1 1 230 230 26
1 2 204 230 51
1 3 178 230 76
1 4 153 230 102
1 5 128 230 128
1 6 102 230 153
1 7 76 230 178
1 8 51 230 204
1 9 26 230 230
2 0 255 204 0
2 1 230 204 26
2 2 204 204 51
2 3 178 204 76
2 4 153 204 102
2 5 128 204 128
2 6 102 204 153
2 7 76 204 178
2 8 51 204 204
2 9 26 204 230
3 0 255 178 0
3 1 230 178 26
3 2 204 178 51
3 3 178 178 76
3 4 153 178 102
3 5 128 178 128
3 6 102 178 153
3 7 76 178 178
3 8 51 178 204
3 9 26 178 230
4 0 255 153 0
4 1 230 153 26
4 2 204 153 51
4 3 178 153 76
4 4 153 153 102
4 5 128 153 128
4 6 102 153 153
4 7 76 153 178
4 8 51 153 204
4 9 26 153 230
5 0 255 128 0
5 1 230 128 26
5 2 204 128 51
5 3 178 128 76
5 4 153 128 102
5 5 128 128 128
5 6 102 128 153
5 7 76 128 178
5 8 51 128 204
5 9 26 128 230
6 0 255 102 0
6 1 230 102 26
6 2 204 102 51
6 3 178 102 76
6 4 153 102 102
6 5 128 102 128
6 6 102 102 153
6 7 76 102 178
6 8 51 102 204
6 9 26 102 230
7 0 255 76 0
7 1 230 76 26
7 2 204 76 51
7 3 178 76 76
7 4 153 76 102
7 5 128 76 128
7 6 102 76 153
7 7 76 76 178
7 8 51 76 204
7 9 26 76 230
8 0 255 51 0
8 1 230 51 26
8 2 204 51 51
8 3 178 51 76
8 4 153 51 102
8 5 128 51 128
8 6 102 51 153
8 7 76 51 178
8 8 51 51 204
8 9 26 51 230
9 0 255 26 0
9 1 230 26 26
9 2 204 26 51
9 3 178 26 76
9 4 153 26 102
9 5 128 26 128
9 6 102 26 153
9 7 76 26 178
9 8 51 26 204
9 9 26 26 230
Please wait a moment while I gather a list of all available modules...
Bio binhex keyword rlcompleter
IPython bisect kiwisolver runpy
PIL bleach linecache sched
__future__ bs4 locale scipy
_abc builtins logging secrets
_ast bz2 lxml select
_bisect cProfile lzma selectors
_blake2 calendar mailbox setuptools
_bootlocale cgi mailcap shelve
_bz2 cgitb markupsafe shlex
_codecs chunk marshal shutil
_codecs_cn cloudpickle math signal
_codecs_hk cmath matplotlib site
_codecs_iso2022 cmd micropip sitecustomize
_codecs_jp code mimetypes six
_codecs_kr codecs mmap skimage
_codecs_tw codeop mne sklearn
_collections collections modulefinder smtpd
_collections_abc colorsys more_itertools smtplib
_compat_pickle compileall mpl_toolkits sndhdr
_compression concurrent mpmath socket
_contextvars configparser msgpack socketserver
_crypt contextlib multiprocessing soupsieve
_csv contextvars netrc sqlite3
_datetime copy networkx sre_compile
_decimal copyreg nltk sre_constants
_dummy_thread crypt nntplib sre_parse
_functools cssselect nose ssl
_heapq csv ntpath stat
_imp cycler nturl2path statistics
_io cytoolz numbers statsmodels
_ivp dataclasses numcodecs string
_json datetime numpy stringprep
_locale dateutil opcode struct
_lsprof decimal operator subprocess
_markupbase decorator optparse sunau
_md5 difflib os symbol
_multibytecodec dis osmiter sympy
_operator distlib p5 symtable
_pickle distutils packaging sys
_posixsubprocess doctest pandas sysconfig
_py_abc docutils parser tabnanny
_pydecimal dummy_threading parso tarfile
_pyio easy_install pathlib telnetlib
_queue email patsy tempfile
_random encodings pdb textwrap
_sha1 enum pickle this
_sha256 errno pickletools threading
_sha3 faulthandler pipes time
_sha512 filecmp pkg_resources timeit
_signal fileinput pkgutil token
_sitebuiltins fnmatch platform tokenize
_socket folium plistlib toolz
_sqlite3 formatter pluggy trace
_sre fractions poplib traceback
_stat freesasa posix tracemalloc
_string ftplib posixpath traits
_strptime functools pprint tty
_struct future profile turtle
_symtable gc proj4py tutor
_sysconfigdata__emscripten_ genericpath pstats types
_testcapi getopt pty typing
_thread getpass pwd uncertainties
_threading_local gettext py unicodedata
_tracemalloc glob py_compile unittest
_warnings graphviz pyclbr urllib
_weakref gzip pydoc uu
_weakrefset hashlib pydoc_data uuid
abc heapq pyexpat warnings
aifc hmac pygments wave
antigravity html pyodide weakref
argparse html5lib pyodide_interrupts webbrowser
array http pyparsing webencodings
asciitree imageio pyroutelib3 wsgiref
ast imaplib pysat xdrlib
astropy imghdr pystone xlrd
asynchat imp pytest xml
asyncio importlib pytz xmlrpc
asyncore inspect pywt xxsubtype
atexit io qrcode yt
atomicwrites ipaddress queue zarr
attr itertools quopri zipapp
autograd jedi random zipfile
base64 jinja2 re zipimport
basthon joblib regex zlib
bdb js reprlib
binascii json requests
Bio binhex json requests
IPython bisect keyword rlcompleter
PIL bleach kiwisolver runpy
__future__ bs4 linecache sched
_abc builtins locale scipy
_ast bz2 logging secrets
_bisect cProfile lxml select
_blake2 calendar lzma selectors
_bootlocale cgi mailbox setuptools
_bz2 cgitb mailcap shelve
_codecs chunk markupsafe shlex
_codecs_cn cloudpickle marshal shutil
_codecs_hk cmath math signal
_codecs_iso2022 cmd matplotlib site
_codecs_jp code micropip sitecustomize
_codecs_kr codecs mimetypes six
_codecs_tw codeop mmap skimage
_collections collections mne sklearn
_collections_abc colorsys modulefinder smtpd
_compat_pickle compileall more_itertools smtplib
_compression concurrent mpl_toolkits sndhdr
_contextvars configparser mpmath socket
_crypt contextlib msgpack socketserver
_csv contextvars multiprocessing soupsieve
_datetime copy netrc sqlite3
_decimal copyreg networkx sre_compile
_dummy_thread crypt nltk sre_constants
_functools cssselect nntplib sre_parse
_heapq csv nose ssl
_imp cycler ntpath stat
_io cytoolz nturl2path statistics
_ivp dataclasses numbers statsmodels
_json datetime numcodecs string
_locale dateutil numpy stringprep
_lsprof decimal opcode struct
_markupbase decorator operator subprocess
_md5 difflib optparse sunau
_multibytecodec dis os symbol
_operator distlib osmiter sympy
_pickle distutils p5 symtable
_posixsubprocess doctest packaging sys
_py_abc docutils pandas sysconfig
_pydecimal dummy_threading parser tabnanny
_pyio easy_install parso tarfile
_queue email pathlib telnetlib
_random encodings patsy tempfile
_sha1 enum pdb textwrap
_sha256 errno pickle this
_sha3 faulthandler pickletools threading
_sha512 filecmp pipes time
_signal fileinput pkg_resources timeit
_sitebuiltins fnmatch pkgutil token
_socket folium platform tokenize
_sqlite3 formatter plistlib toolz
_sre fractions pluggy trace
_stat freesasa poplib traceback
_string ftplib posix tracemalloc
_strptime functools posixpath traits
_struct future pprint tty
_symtable gc profile turtle
_sysconfigdata__emscripten_ genericpath proj4py tutor
_testcapi getopt pstats types
_thread getpass pty typing
_threading_local gettext pwd uncertainties
_tracemalloc glob py unicodedata
_warnings graphviz py_compile unittest
_weakref gzip pyclbr urllib
_weakrefset hashlib pydoc uu
abc heapq pydoc_data uuid
aifc hmac pyexpat warnings
antigravity html pygments wave
argparse html5lib pyodide weakref
array http pyodide_interrupts webbrowser
asciitree imageio pyparsing webencodings
ast imaplib pyroutelib3 wsgiref
astropy imghdr pysat xdrlib
asynchat imp pystone xlrd
asyncio importlib pytest xml
asyncore inspect pytz xmlrpc
atexit io pywt xxsubtype
atomicwrites ipaddress qrcode yt
attr ipythonblocks queue zarr
autograd itertools quopri zipapp
base64 jedi random zipfile
basthon jinja2 re zipimport
bdb joblib regex zlib
binascii js reprlib
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
......
......@@ -96,6 +96,7 @@ def test_importables(selenium):
result = selenium.run_basthon("from basthon import kernel ; kernel.importables()")['result']
importables = eval(result['result']['text/plain'])
# to easily update importables.json in case a package is added
with open(Path(__file__).parent / "data" / "importables.generated_during_tests.json", 'w') as f:
json.dump(importables, f)
with open(Path(__file__).parent / "data" / "importables.json") as f:
......
......@@ -170,3 +170,31 @@ def test_osmiter(selenium):
def test_pyroutelib3(selenium):
# already tested in test_patched_modules
assert True
def test_ipythonblocks(selenium):
result = selenium.run_basthon("""
from ipythonblocks import BlockGrid
w = h = 10
grid = BlockGrid(w, h, block_size=4)
for block in grid:
block.red = 255 * float(w - block.col) / w
block.green = 255 * float(h - block.row) / h
block.blue = 255 * block.col / w
grid.to_text()
grid.show_image()
""")
print(result)
assert 'result' not in result['result']
assert result['stderr'] == ""
with open(_test_data / "ipythonblocks_to_text.txt") as f:
assert result['stdout'] == f.read()
assert result['display']['display_type'] == 'multiple'
png = base64.b64decode(result['display']['content']['image/png'])
with open(_test_data / "ipythonblocks_save_image.png", 'rb') as f:
target = f.read()
assert png == target
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment