Commit 0c82a297 authored by Romain Casati's avatar Romain Casati
Browse files

Testing binarytree.

parent a2248a4f
digraph {
node [color=lightgray fillcolor=lightgray fontcolor=black shape=record style="filled, rounded"]
[label="<l>|<v> 1|<r>"]
:l -> :v
:r -> :v
[label="<l>|<v> 2|<r>"]
:l -> :v
:r -> :v
[label="<l>|<v> 3|<r>"]
[label="<l>|<v> 4|<r>"]
[label="<l>|<v> 5|<r>"]
}
\ 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", "lolviz", "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", "binarytree", "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", "lolviz", "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
Please wait a moment while I gather a list of all available modules...
Bio binhex json reprlib
IPython bisect keyword requests
PIL bleach kiwisolver rlcompleter
__future__ bs4 linecache runpy
_abc builtins locale sched
_ast bz2 logging scipy
_bisect cProfile lolviz secrets
_blake2 calendar lxml select
_bootlocale cgi lzma selectors
_bz2 cgitb mailbox setuptools
_codecs chunk mailcap shelve
_codecs_cn cloudpickle markupsafe shlex
_codecs_hk cmath marshal shutil
_codecs_iso2022 cmd math signal
_codecs_jp code matplotlib site
_codecs_kr codecs micropip sitecustomize
_codecs_tw codeop mimetypes six
_collections collections mmap skimage
_collections_abc colorsys mne sklearn
_compat_pickle compileall modulefinder smtpd
_compression concurrent more_itertools smtplib
_contextvars configparser mpl_toolkits sndhdr
_crypt contextlib mpmath socket
_csv contextvars msgpack socketserver
_datetime copy multiprocessing soupsieve
_decimal copyreg netrc sqlite3
_dummy_thread crypt networkx sre_compile
_functools cssselect nltk sre_constants
_heapq csv nntplib sre_parse
_imp cycler nose ssl
_io cytoolz ntpath stat
_ivp dataclasses nturl2path statistics
_json datetime numbers statsmodels
_locale dateutil numcodecs string
_lsprof decimal numpy stringprep
_markupbase decorator opcode struct
_md5 difflib operator subprocess
_multibytecodec dis optparse sunau
_operator distlib os symbol
_pickle distutils osmiter sympy
_posixsubprocess doctest p5 symtable
_py_abc docutils packaging sys
_pydecimal dummy_threading pandas sysconfig
_pyio easy_install parser tabnanny
_queue email parso tarfile
_random encodings pathlib telnetlib
_sha1 enum patsy tempfile
_sha256 errno pdb textwrap
_sha3 faulthandler pickle this
_sha512 filecmp pickletools threading
_signal fileinput pipes time
_sitebuiltins fnmatch pkg_resources timeit
_socket folium pkgutil token
_sqlite3 formatter platform tokenize
_sre fractions plistlib toolz
_stat freesasa pluggy trace
_string ftplib poplib traceback
_strptime functools posix tracemalloc
_struct future posixpath traits
_symtable gc pprint tty
_sysconfigdata__emscripten_ genericpath profile turtle
_testcapi getopt proj4py tutor
_thread getpass pstats types
_threading_local gettext pty typing
_tracemalloc glob pwd uncertainties
_warnings graphviz py unicodedata
_weakref gzip py_compile unittest
_weakrefset hashlib pyclbr urllib
abc heapq pydoc uu
aifc hmac pydoc_data uuid
antigravity html pyexpat warnings
argparse html5lib pygments wave
array http pyodide weakref
asciitree imageio pyodide_interrupts webbrowser
ast imaplib pyparsing webencodings
astropy imghdr pyroutelib3 wsgiref
asynchat imp pysat xdrlib
asyncio importlib pystone xlrd
asyncore inspect pytest xml
atexit io pytz xmlrpc
atomicwrites ipaddress pywt xxsubtype
attr ipythonblocks qrcode yt
autograd itertools queue zarr
base64 jedi quopri zipapp
basthon jinja2 random zipfile
bdb joblib re zipimport
binascii js regex zlib
Bio binhex keyword rlcompleter
IPython bisect kiwisolver runpy
PIL bleach linecache sched
__future__ bs4 locale scipy
_abc builtins logging secrets
_ast bz2 lolviz select
_bisect cProfile lxml selectors
_blake2 calendar lzma setuptools
_bootlocale cgi mailbox shelve
_bz2 cgitb mailcap shlex
_codecs chunk markupsafe shutil
_codecs_cn cloudpickle marshal signal
_codecs_hk cmath math site
_codecs_iso2022 cmd matplotlib sitecustomize
_codecs_jp code micropip six
_codecs_kr codecs mimetypes skimage
_codecs_tw codeop mmap sklearn
_collections collections mne smtpd
_collections_abc colorsys modulefinder smtplib
_compat_pickle compileall more_itertools sndhdr
_compression concurrent mpl_toolkits socket
_contextvars configparser mpmath socketserver
_crypt contextlib msgpack soupsieve
_csv contextvars multiprocessing sqlite3
_datetime copy netrc sre_compile
_decimal copyreg networkx sre_constants
_dummy_thread crypt nltk sre_parse
_functools cssselect nntplib ssl
_heapq csv nose stat
_imp cycler ntpath statistics
_io cytoolz nturl2path statsmodels
_ivp dataclasses numbers string
_json datetime numcodecs stringprep
_locale dateutil numpy struct
_lsprof decimal opcode subprocess
_markupbase decorator operator sunau
_md5 difflib optparse symbol
_multibytecodec dis os sympy
_operator distlib osmiter symtable
_pickle distutils p5 sys
_posixsubprocess doctest packaging sysconfig
_py_abc docutils pandas tabnanny
_pydecimal dummy_threading parser tarfile
_pyio easy_install parso telnetlib
_queue email pathlib tempfile
_random encodings patsy textwrap
_sha1 enum pdb this
_sha256 errno pickle threading
_sha3 faulthandler pickletools time
_sha512 filecmp pipes timeit
_signal fileinput pkg_resources token
_sitebuiltins fnmatch pkgutil tokenize
_socket folium platform toolz
_sqlite3 formatter plistlib trace
_sre fractions pluggy traceback
_stat freesasa poplib tracemalloc
_string ftplib posix traits
_strptime functools posixpath tty
_struct future pprint turtle
_symtable gc profile tutor
_sysconfigdata__emscripten_ genericpath proj4py types
_testcapi getopt pstats typing
_thread getpass pty uncertainties
_threading_local gettext pwd unicodedata
_tracemalloc glob py unittest
_warnings graphviz py_compile urllib
_weakref gzip pyclbr uu
_weakrefset hashlib pydoc uuid
abc heapq pydoc_data warnings
aifc hmac pyexpat wave
antigravity html pygments weakref
argparse html5lib pyodide webbrowser
array http pyodide_interrupts webencodings
asciitree imageio pyparsing wsgiref
ast imaplib pyroutelib3 xdrlib
astropy imghdr pysat xlrd
asynchat imp pystone xml
asyncio importlib pytest xmlrpc
asyncore inspect pytz xxsubtype
atexit io pywt yt
atomicwrites ipaddress qrcode zarr
attr ipythonblocks queue zipapp
autograd itertools quopri zipfile
base64 jedi random zipimport
basthon jinja2 re zlib
bdb joblib regex
binarytree js reprlib
binascii json requests
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
......
......@@ -218,3 +218,8 @@ o
result['result']['result']['image/svg+xml'])
with open(_test_data / "lolviz.svg") as f:
assert target == f.read()
def test_binarytree(selenium):
# already tested in test_patched_modules
assert True
......@@ -200,3 +200,36 @@ def test_micropip(selenium):
import requests
requests.__author__ == 'Romain Casati'""")
assert result['result']['result']['text/plain'] == 'True'
def test_binarytree(selenium):
from ast import literal_eval
result = selenium.run_basthon("""
from binarytree import Node
root = Node(1)
root.left = Node(2)
root.right = Node(3)
root.left.left = Node(4)
root.left.right = Node(5)
print(root)
root.graphviz().source
""")
assert result['stderr'] == ""
assert result['stdout'] == """
__1
/ \\
2 3
/ \\
4 5
"""
target = literal_eval(result['result']['result']['text/plain'])
target = re.sub('[0-9]+:l', ':l', target)
target = re.sub('[0-9]+:r', ':r', target)
target = re.sub('[0-9]+:v', ':v', target)
target = re.sub(r'[0-9]+ -> [0-9]+ \[label=', ' -> [label=', target)
target = re.sub(r'[0-9]+ \[label=', ' [label=', target)
with open(_test_data / "binarytree.gv") as f:
assert target == f.read()
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