How to use the wasmer.Module function in wasmer

To help you get started, we’ve selected a few wasmer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wasmerio / python-ext-wasm / tests / test_module.py View on Github external
def test_deserialize():
    serialized_module = Module(TEST_BYTES).serialize()
    module = Module.deserialize(serialized_module)
    del serialized_module

    assert module.instantiate().exports.sum(1, 2) == 3
github wasmerio / python-ext-wasm / tests / test_module.py View on Github external
def test_compile():
    assert isinstance(Module(TEST_BYTES), Module)
github wasmerio / python-ext-wasm / tests / test_module.py View on Github external
def test_instantiate():
    assert Module(TEST_BYTES).instantiate().exports.sum(1, 2) == 3
github wasmerio / python-ext-wasm / tests / test_module.py View on Github external
def test_failed_to_compile():
    with pytest.raises(RuntimeError) as context_manager:
        Module(INVALID_TEST_BYTES)

    exception = context_manager.value
    assert str(exception) == (
        'Failed to compile the module:\n    Validation error "Invalid type"'
    )
github wasmerio / python-ext-wasm / tests / test_module.py View on Github external
def test_serialize():
    assert type(Module(TEST_BYTES).serialize()) == bytes