예제 #1
0
def test_garbage_collected_dsl_raises_runtime_error():
    mnemonic = Mnemonic('FOO')
    asm = AsmDsl()
    labeller = asm.label
    del asm
    gc.collect()
    with raises(RuntimeError):
        labeller(mnemonic)
예제 #2
0
def test_mnemonic_repr(m):
    r = repr(Mnemonic(m))
    assert r.startswith('Mnemonic')
    assert m in r
    assert check_balanced(r)
예제 #3
0
def test_mnemonic_value(m):
    assert str(Mnemonic(m)) == m
예제 #4
0
def test_mnemonic_illegal_initial_character_raises_value_error(m):
    with raises(ValueError):
        Mnemonic(m)
예제 #5
0
def test_empty_mnemonic_raises_value_error():
    with raises(ValueError):
        Mnemonic('')
예제 #6
0
def test_mnemonic_interning(m):
    assert Mnemonic(m) is Mnemonic(m)
예제 #7
0
def test_mnemonic_illegal_unicode_categories_raise_value_error(p, q):
    m = p + q
    with raises(ValueError):
        Mnemonic(m)
예제 #8
0
def test_negative_indirect_address_raises_value_error(address):
    FOO = Mnemonic('FOO')
    asm = AsmDsl()
    with raises(ValueError):
        asm(FOO, {address})
예제 #9
0
def test_parse_operand_unsupported_indirect_type_raises_not_implemented_error(
):
    FOO = Mnemonic('FOO')
    asm = AsmDsl()
    with raises(TypeError):
        asm(FOO, [object()])
예제 #10
0
def test_unknown_mnemonic_raises_value_error():
    mnemonic = Mnemonic("XXX")
    asm = AsmDsl()
    with raises(ValueError):
        asm(mnemonic)
예제 #11
0
def test_unknown_mnemonic_raises_value_error(m):
    mnemonic = Mnemonic(m)
    assume(mnemonic not in MNEMONIC_TO_STATEMENT)
    asm = AsmDsl()
    with raises(ValueError):
        asm(mnemonic)