Ejemplo n.º 1
0
def test_intrinsic_function_reference_error2(f2003_create):
    '''Test that class Intrinsic_Function_Reference raises the expected
    exception when the valid min args is less than the valid max args
    and the wrong number of arguments is supplied.

    '''
    with pytest.raises(InternalSyntaxError) as excinfo:
        _ = Intrinsic_Function_Reference("PRODUCT()")
    assert ("Intrinsic 'PRODUCT' expects between 1 and 3 args but found 0."
            "" in str(excinfo.value))

    with pytest.raises(InternalSyntaxError) as excinfo:
        _ = Intrinsic_Function_Reference("PRODUCT(A,B,C,D)")
    assert ("Intrinsic 'PRODUCT' expects between 1 and 3 args but found 4."
            "" in str(excinfo.value))
Ejemplo n.º 2
0
def test_intrinsic_function_reference_error1(f2003_create):
    '''Test that class Intrinsic_Function_Reference raises the expected
    exception when the valid min and max args are equal (2 in this case)
    and the wrong number of arguments is supplied.

    '''
    with pytest.raises(InternalSyntaxError) as excinfo:
        _ = Intrinsic_Function_Reference("MATMUL(A)")
    assert ("Intrinsic 'MATMUL' expects 2 arg(s) but found 1."
            "" in str(excinfo.value))

    with pytest.raises(InternalSyntaxError) as excinfo:
        _ = Intrinsic_Function_Reference("MATMUL(A,B,C)")
    assert ("Intrinsic 'MATMUL' expects 2 arg(s) but found 3."
            "" in str(excinfo.value))
Ejemplo n.º 3
0
def test_intrinsic_function_nomatch(f2003_create):
    '''Test that class Intrinsic_Function_Reference raises the expected
    exception if there is no match.

    '''
    with pytest.raises(NoMatchError):
        _ = Intrinsic_Function_Reference("NO_MATCH(A)")
Ejemplo n.º 4
0
def test_intrinsic_function_reference_zero_args(f2003_create):
    '''Test that class Intrinsic_Function_Reference correctly matches a
    generic intrinsic which accepts zero arguments.

    '''
    result = Intrinsic_Function_Reference("COMMAND_ARGUMENT_COUNT()")
    assert isinstance(result, Intrinsic_Function_Reference)
    assert str(result) == "COMMAND_ARGUMENT_COUNT()"
Ejemplo n.º 5
0
def test_intrinsic_function_reference(f2003_create):
    '''Test that class Intrinsic_Function_Reference correctly matches a
    specific intrinsic with a valid number of arguments.

    '''
    result = Intrinsic_Function_Reference("DSIN(A)")
    assert isinstance(result, Intrinsic_Function_Reference)
    assert str(result) == "DSIN(A)"
Ejemplo n.º 6
0
def test_intrinsic_function_reference_error3(f2003_create):
    '''Test that class Intrinsic_Function_Reference raises the expected
    exception when the number of arguments is unlimited.

    '''
    with pytest.raises(InternalSyntaxError) as excinfo:
        _ = Intrinsic_Function_Reference("MIN(A)")
    assert ("Intrinsic 'MIN' expects at least 2 args but found 1."
            "" in str(excinfo.value))
Ejemplo n.º 7
0
def test_intrinsic_function_reference_unlimited_args(f2003_create):
    '''Test that class Intrinsic_Function_Reference correctly matches a
    generic intrinsic which accepts an unlimitednumber of arguments.

    '''
    for args in ["A, B", "A, B, C", "A, B, C, D"]:
        result = Intrinsic_Function_Reference("MAX({0})".format(args))
        assert isinstance(result, Intrinsic_Function_Reference)
        assert str(result) == "MAX({0})".format(args)
Ejemplo n.º 8
0
def test_intrinsic_function_reference_range_args(f2003_create):
    '''Test that class Intrinsic_Function_Reference correctly matches a
    generic intrinsic which accepts a range of number of arguments.

    '''
    for args in ["", "A", "A, B", "A, B, C"]:
        result = Intrinsic_Function_Reference("SYSTEM_CLOCK({0})".format(args))
        assert isinstance(result, Intrinsic_Function_Reference)
        assert str(result) == "SYSTEM_CLOCK({0})".format(args)
Ejemplo n.º 9
0
def test_intrinsic_function_reference_multi_args(f2003_create):
    '''Test that class Intrinsic_Function_Reference correctly matches a
    generic intrinsic which accepts more than one argument (two in
    this case).

    '''
    result = Intrinsic_Function_Reference("MATMUL(A,B)")
    assert isinstance(result, Intrinsic_Function_Reference)
    assert str(result) == "MATMUL(A, B)"