예제 #1
0
def test():
    """
    Verify that the {unresolved} class hierarchy looks as expected
    """
    # get the {calc}
    from p2.calc import calculator
    # and {algebraic} metaclasses
    from p2.algebraic import algebra

    # get the base node from the {calc} package
    from p2.calc.Node import Node as node

    # get the base node {mro}
    nodeMRO = node.mro()

    # get the unresolved class
    unresolved = node.unresolved
    # and its mro
    unresolvedMRO = unresolved.mro()
    # verify the structure
    assert unresolvedMRO == [
        unresolved,
        calculator.observable, calculator.reactor,
        calculator.unresolved, algebra.leaf
        ] + nodeMRO

    # all done
    return
예제 #2
0
def test():
    """
    Verify that the {literal} class hierarchy looks as expected
    """
    # get the {calc}
    from p2.calc import calculator
    # and {algebraic} metaclasses
    from p2.algebraic import algebra

    # get the base node from the {calc} package
    from p2.calc.Node import Node as node

    # get the base node {mro}
    nodeMRO = node.mro()

    # get the literal class
    literal = node.literal
    # and its mro
    literalMRO = literal.mro()
    # verify the structure
    assert literalMRO == [
        literal, calculator.const, calculator.value, algebra.literal,
        algebra.leaf
    ] + nodeMRO

    # all done
    return
예제 #3
0
def test():
    """
    Verify that the {node} class hierarchy looks as expected
    """
    # get the {calc}
    import p2.calc
    # and {algebraic} packages
    import p2.algebraic

    # access
    from p2.calc.Node import Node as node

    # pull out the {calc} metaclass
    calculator = p2.calc.calculator
    # and the base metaclass
    algebra = p2.algebraic.algebra

    # get the base node {mro}
    nodeMRO = node.mro()
    # verify the derivation of the base node
    assert nodeMRO == [
        node, calculator.base, algebra.base, calculator.arithmetic, object
    ]

    # all done
    return
예제 #4
0
def test():
    """
    Verify that the {variable} class hierarchy looks as expected
    """
    # get the {calc}
    from p2.calc import calculator
    # and {algebraic} metaclasses
    from p2.algebraic import algebra

    # get the base node from the {calc} package
    from p2.calc.Node import Node as node

    # get the base node {mro}
    nodeMRO = node.mro()

    # get the variable class
    variable = node.variable
    # and its mro
    variableMRO = variable.mro()
    # verify the structure
    assert variableMRO == [
        # the user visible class
        variable,
        # observable
        calculator.dependency, calculator.observable, calculator.reactor,
        # value management
        calculator.value,
        # base {variable} from {algebra}
        algebra.variable, algebra.leaf
        # node
        ] + nodeMRO

    # all done
    return
예제 #5
0
def test():
    """
    Verify that the {list} class hierarchy looks as expected
    """
    # get the {calc}
    from p2.calc import calculator
    # and {algebraic} metaclasses
    from p2.algebraic import algebra

    # get the base node from the {calc} package
    from p2.calc.Node import Node as node

    # get the base node {mro}
    nodeMRO = node.mro()

    # get the list class
    list = node.list
    # and its mro
    listMRO = list.mro()
    # verify the structure
    assert listMRO == [
        # the user visible class
        list,
        # observer
        calculator.dependent,
        calculator.observer,
        # observable
        calculator.dependency,
        calculator.observable,
        calculator.reactor,
        # base {list} from {calculator}
        calculator.list,
        # base {sequence} from {calculator}
        calculator.sequence,
        # composite
        node.composite,
        algebra.composite
        # node
    ] + nodeMRO

    # all done
    return
예제 #6
0
def test():
    """
    Verify that the {count} class hierarchy looks as expected
    """
    # get the {calc}
    from p2.calc import calculator
    # and {algebraic} metaclasses
    from p2.algebraic import algebra

    # get the base node from the {calc} package
    from p2.calc.Node import Node as node

    # get the base node {mro}
    nodeMRO = node.mro()

    # get the count operator
    count = node.count
    # and its mro
    countMRO = count.mro()
    # verify the structure
    assert countMRO == [
        # the user visible class
        node.count,
        # observer
        calculator.dependent,
        calculator.observer,
        # observable
        calculator.dependency,
        calculator.observable,
        calculator.reactor,
        # the evaluator
        calculator.count,
        # composite
        node.composite,
        algebra.composite
        # node
    ] + nodeMRO

    # all done
    return