If no indexURL is provided, we throw and catch an error and
then use ErrorStackParser to calculate where pyodide.js has
been loaded from. Resolves #2290.
ENH Calculate indexURL from error stack trace. If no indexURL is provided, we throw and catch an error and
then use ErrorStackParser to calculate where pyodide.js has
been loaded from. Resolves #2290.
from pyodide_build.testing import run_in_pyodide


@run_in_pyodide(
    packages=["pywavelets"], driver_timeout=30, xfail_browsers={"chrome": "xfail"}
)
def test_pywt():
    import numpy as np
    import pywt

    def checkit(a, v):
        assert (np.rint(a) == v).all()

    x = [3, 7, 1, 1, -2, 5, 4, 6]
    cA, cD = pywt.dwt(x, "db2")
    w = pywt.Wavelet("sym3")
    checkit(pywt.idwt(cA, cD, "db2"), x)
    cA, cD = pywt.dwt(x, wavelet=w, mode="periodization")
    checkit(pywt.idwt(cA, cD, "sym3", "symmetric"), [1, 1, -2, 5])
    checkit(pywt.idwt(cA, cD, "sym3", "periodization"), x)

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide(
    packages=["pywavelets"], driver_timeout=30, xfail_browsers={"chrome": "xfail"}
)
def test_pywt():
    import numpy as np
    import pywt

    def checkit(a, v):
        assert (np.rint(a) == v).all()

    x = [3, 7, 1, 1, -2, 5, 4, 6]
    cA, cD = pywt.dwt(x, "db2")
    w = pywt.Wavelet("sym3")
    checkit(pywt.idwt(cA, cD, "db2"), x)
    cA, cD = pywt.dwt(x, wavelet=w, mode="periodization")
    checkit(pywt.idwt(cA, cD, "sym3", "symmetric"), [1, 1, -2, 5])
    checkit(pywt.idwt(cA, cD, "sym3", "periodization"), x)
