# Tests of lib/coins.py

import pytest

from electrumx.lib.coins import BitcoinSV
from electrumx.lib.script import OpCodes


coin = BitcoinSV

@pytest.mark.parametrize("script", (
    bytes([OpCodes.OP_RETURN]),
    bytes([OpCodes.OP_RETURN]) + bytes([2, 28, 50]),
    bytes([OpCodes.OP_0, OpCodes.OP_RETURN]),
    bytes([OpCodes.OP_0, OpCodes.OP_RETURN]) + bytes([2, 28, 50]),
))
def test_op_return(script):
    assert coin.hashX_from_script(script) is None


@pytest.mark.parametrize("script", (
    bytes([]),
    bytes([OpCodes.OP_1, OpCodes.OP_RETURN]) + bytes([2, 28, 50]),
    bytes([OpCodes.OP_0]),
    bytes([OpCodes.OP_0, OpCodes.OP_1]),
    bytes([OpCodes.OP_HASH160]),
))
def test_not_op_return(script):
    assert coin.hashX_from_script(script) is not None

153f08b31b47cd698045da17ac77aed456ff7fb4
<mask token>


@pytest.mark.parametrize('script', (bytes([]), bytes([OpCodes.OP_1, OpCodes
    .OP_RETURN]) + bytes([2, 28, 50]), bytes([OpCodes.OP_0]), bytes([
    OpCodes.OP_0, OpCodes.OP_1]), bytes([OpCodes.OP_HASH160])))
def test_not_op_return(script):
    assert coin.hashX_from_script(script) is not None

<mask token>


@pytest.mark.parametrize('script', (bytes([OpCodes.OP_RETURN]), bytes([
    OpCodes.OP_RETURN]) + bytes([2, 28, 50]), bytes([OpCodes.OP_0, OpCodes.
    OP_RETURN]), bytes([OpCodes.OP_0, OpCodes.OP_RETURN]) + bytes([2, 28, 50]))
    )
def test_op_return(script):
    assert coin.hashX_from_script(script) is None


@pytest.mark.parametrize('script', (bytes([]), bytes([OpCodes.OP_1, OpCodes
    .OP_RETURN]) + bytes([2, 28, 50]), bytes([OpCodes.OP_0]), bytes([
    OpCodes.OP_0, OpCodes.OP_1]), bytes([OpCodes.OP_HASH160])))
def test_not_op_return(script):
    assert coin.hashX_from_script(script) is not None

<mask token>
coin = BitcoinSV


@pytest.mark.parametrize('script', (bytes([OpCodes.OP_RETURN]), bytes([
    OpCodes.OP_RETURN]) + bytes([2, 28, 50]), bytes([OpCodes.OP_0, OpCodes.
    OP_RETURN]), bytes([OpCodes.OP_0, OpCodes.OP_RETURN]) + bytes([2, 28, 50]))
    )
def test_op_return(script):
    assert coin.hashX_from_script(script) is None


@pytest.mark.parametrize('script', (bytes([]), bytes([OpCodes.OP_1, OpCodes
    .OP_RETURN]) + bytes([2, 28, 50]), bytes([OpCodes.OP_0]), bytes([
    OpCodes.OP_0, OpCodes.OP_1]), bytes([OpCodes.OP_HASH160])))
def test_not_op_return(script):
    assert coin.hashX_from_script(script) is not None

import pytest
from electrumx.lib.coins import BitcoinSV
from electrumx.lib.script import OpCodes
coin = BitcoinSV


@pytest.mark.parametrize('script', (bytes([OpCodes.OP_RETURN]), bytes([
    OpCodes.OP_RETURN]) + bytes([2, 28, 50]), bytes([OpCodes.OP_0, OpCodes.
    OP_RETURN]), bytes([OpCodes.OP_0, OpCodes.OP_RETURN]) + bytes([2, 28, 50]))
    )
def test_op_return(script):
    assert coin.hashX_from_script(script) is None


@pytest.mark.parametrize('script', (bytes([]), bytes([OpCodes.OP_1, OpCodes
    .OP_RETURN]) + bytes([2, 28, 50]), bytes([OpCodes.OP_0]), bytes([
    OpCodes.OP_0, OpCodes.OP_1]), bytes([OpCodes.OP_HASH160])))
def test_not_op_return(script):
    assert coin.hashX_from_script(script) is not None

# Tests of lib/coins.py

import pytest

from electrumx.lib.coins import BitcoinSV
from electrumx.lib.script import OpCodes


coin = BitcoinSV

@pytest.mark.parametrize("script", (
    bytes([OpCodes.OP_RETURN]),
    bytes([OpCodes.OP_RETURN]) + bytes([2, 28, 50]),
    bytes([OpCodes.OP_0, OpCodes.OP_RETURN]),
    bytes([OpCodes.OP_0, OpCodes.OP_RETURN]) + bytes([2, 28, 50]),
))
def test_op_return(script):
    assert coin.hashX_from_script(script) is None


@pytest.mark.parametrize("script", (
    bytes([]),
    bytes([OpCodes.OP_1, OpCodes.OP_RETURN]) + bytes([2, 28, 50]),
    bytes([OpCodes.OP_0]),
    bytes([OpCodes.OP_0, OpCodes.OP_1]),
    bytes([OpCodes.OP_HASH160]),
))
def test_not_op_return(script):
    assert coin.hashX_from_script(script) is not None
