Commit 94712d3a authored by Romain Casati's avatar Romain Casati
Browse files

Testing scipy.integrate.odeint.

parent e353b7dc
......@@ -75,7 +75,8 @@ class SeleniumWrapper:
raise ValueError(
f"{(build_dir / 'test.html').resolve()} does not exist!"
)
self.driver.implicitly_wait(30)
self.driver.implicitly_wait(60)
self.driver.set_script_timeout(60)
self.driver.get(f"http://{server_hostname}:{server_port}/test.html")
self.run_js("await Basthon.loaded();")
self.run_js("Error.stackTraceLimit = Infinity")
......
modules.generated_during_tests.txt
\ No newline at end of file
modules.generated_during_tests.txt
importables.generated_during_tests.json
\ 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", "_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", "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", "pysat", "pystone", "pytest", "pytz", "pywt", "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"]
["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", "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", "pysat", "pystone", "pytest", "pytz", "pywt", "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 runpy
IPython bisect keyword sched
PIL bleach kiwisolver scipy
__future__ bs4 linecache secrets
_abc builtins locale select
_ast bz2 logging selectors
_bisect cProfile lxml setuptools
_blake2 calendar lzma shelve
_bootlocale cgi mailbox shlex
_bz2 cgitb mailcap shutil
_codecs chunk markupsafe signal
_codecs_cn cloudpickle marshal site
_codecs_hk cmath math sitecustomize
_codecs_iso2022 cmd matplotlib six
_codecs_jp code micropip skimage
_codecs_kr codecs mimetypes sklearn
_codecs_tw codeop mmap smtpd
_collections collections mne smtplib
_collections_abc colorsys modulefinder sndhdr
_compat_pickle compileall more_itertools socket
_compression concurrent mpl_toolkits socketserver
_contextvars configparser mpmath soupsieve
_crypt contextlib msgpack sqlite3
_csv contextvars multiprocessing sre_compile
_datetime copy netrc sre_constants
_decimal copyreg networkx sre_parse
_dummy_thread crypt nltk ssl
_functools cssselect nntplib stat
_heapq csv nose statistics
_imp cycler ntpath statsmodels
_io cytoolz nturl2path string
Bio binascii js rlcompleter
IPython binhex json runpy
PIL bisect keyword sched
__future__ bleach kiwisolver scipy
_abc bs4 linecache secrets
_ast builtins locale select
_bisect bz2 logging selectors
_blake2 cProfile lxml setuptools
_bootlocale calendar lzma shelve
_bz2 cgi mailbox shlex
_codecs cgitb mailcap shutil
_codecs_cn chunk markupsafe signal
_codecs_hk cloudpickle marshal site
_codecs_iso2022 cmath math sitecustomize
_codecs_jp cmd matplotlib six
_codecs_kr code micropip skimage
_codecs_tw codecs mimetypes sklearn
_collections codeop mmap smtpd
_collections_abc collections mne smtplib
_compat_pickle colorsys modulefinder sndhdr
_compression compileall more_itertools socket
_contextvars concurrent mpl_toolkits socketserver
_crypt configparser mpmath soupsieve
_csv contextlib msgpack sqlite3
_datetime contextvars multiprocessing sre_compile
_decimal copy netrc sre_constants
_dummy_thread copyreg networkx sre_parse
_functools crypt nltk ssl
_heapq cssselect nntplib stat
_imp csv nose statistics
_io cycler ntpath statsmodels
_ivp cytoolz nturl2path string
_json dataclasses numbers stringprep
_locale datetime numcodecs struct
_lsprof dateutil numpy subprocess
......@@ -86,7 +87,6 @@ autograd itertools re zipfile
base64 jedi regex zipimport
basthon jinja2 reprlib zlib
bdb joblib requests
binascii js rlcompleter
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
......
......@@ -95,6 +95,9 @@ def test_put_module(selenium):
def test_importables(selenium):
result = selenium.run_basthon("from basthon import kernel ; kernel.importables()")['result']
importables = eval(result['result']['text/plain'])
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:
target = json.load(f)
assert importables == target
......
......@@ -150,3 +150,8 @@ tutor()""")
with open(_test_data / "tutor-iframe.html") as f:
target = f.read()
assert target == iframe
def test__ivp(selenium):
# this is tested in test_hacked_modules.test_scipy via odeint
pass
......@@ -136,3 +136,18 @@ def test_turtle(selenium):
with open(_test_data / 'turtle.svg') as f:
target = f.read()
assert svg == target
def test_scipy(selenium):
result = selenium.run_basthon("""
from scipy.integrate import odeint
import numpy as np
def f(y, t, a):
return [-a * y[1], a * y[0]]
y0 = [1, 0]
y = odeint(f, y0, [0, np.pi], args=(2,), hmax=1e-2)
np.allclose(y[-1, :], y0)""")
assert result['result']['result']['text/plain'] == 'True'
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