예제 #1
0
def test_distribution_method_encapsulation_lazy():
    vf = VectorField("Foo", lambda pos: 0)
    da = DelayedArgument(set(), lambda context: Options([1, 2]))
    pt = vf.followFrom(Vector(0, 0), da, steps=1)
    assert isinstance(pt, DelayedArgument)
    evpt = valueInContext(pt, {})
    assert not needsLazyEvaluation(evpt)
    assert isinstance(evpt, VectorMethodDistribution)
    assert evpt.method is underlyingFunction(vf.followFrom)
예제 #2
0
파일: pruning.py 프로젝트: xqyd/Scenic
def isMethodCall(thing, method):
    """Match calls to a given method, taking into account distribution decorators."""
    if not isinstance(thing, (MethodDistribution, VectorMethodDistribution)):
        return False
    return thing.method is underlyingFunction(method)
예제 #3
0
def test_distribution_method_encapsulation():
    vf = VectorField("Foo", lambda pos: 0)
    pt = vf.followFrom(Vector(0, 0), Options([1, 2]), steps=1)
    assert isinstance(pt, VectorMethodDistribution)
    assert pt.method is underlyingFunction(vf.followFrom)
예제 #4
0
def isMethodCall(thing, method):
    if not isinstance(thing, (MethodDistribution, VectorMethodDistribution)):
        return False
    return thing.method is underlyingFunction(method)