
from fastats.core.decorator import fs
from tests import cube


def child(x):
    return x * x


@fs
def parent(a):
    b = 2 * a
    result = child(b)
    return result


def quad(x):
    return cube(x) * x


def test_child_transform_square_to_cube_execution():
    original = parent(2)
    assert original == 16

    result = parent(2, child=cube)
    assert result == 64

    final = parent(2)
    assert final == 16


def test_child_transform_square_to_quadruple():
    original = parent(2)
    assert original == 16

    result = parent(2, child=quad)
    assert result == 256

    final_two = parent(2)
    assert final_two == 16

    final = parent(3)
    assert final == 36


if __name__ == '__main__':
    import pytest
    pytest.main()

@@ -203,16 +203,113 @@
 ) * x%0A%0A%0A
+def zero(x):%0A    return 0%0A%0A%0Adef child_faker(x):%0A    return 42%0A%0A%0Achild_faker.__name__ = 'child'%0A%0A%0A
 def test
@@ -774,16 +774,652 @@
 == 36%0A%0A%0A
+def test_child_transform_square_to_zero():%0A    original = parent(2)%0A    assert original == 16%0A%0A    result = parent(2, child=zero)%0A    assert result == 0%0A%0A    final_two = parent(2)%0A    assert final_two == 16%0A%0A    final = parent(3)%0A    assert final == 36%0A%0A%0Adef test_child_transform_with_faked_child():%0A    # maliciously faking a function's name should not affect the result%0A    # this can also happen when using decorators%0A    assert child_faker.__name__ == child.__name__%0A%0A    original = parent(1)%0A    assert original == 4%0A%0A    result = parent(1, child=child_faker)%0A    assert result == 42%0A%0A    final = parent(1)%0A    assert final == 4%0A%0A%0A
 if __nam

Add a failing, coverage-increasing test