def test_get_function_called_once():
    class TestPrimitive(TransformPrimitive):
        def __init__(self):
            self.get_function_call_count = 0

        def get_function(self):
            self.get_function_call_count += 1

            def test(x):
                return x
            return test

    primitive = TestPrimitive()

    for _ in range(2):
        primitive(range(6))

    assert primitive.get_function_call_count == 1