@@ -54,7 +54,7 @@ def function_missing_reqs() -> "pandas.DataFrame":
54
54
def test_can_load_function_with_reqs (cls ) -> None :
55
55
with tempfile .TemporaryDirectory () as temp_dir :
56
56
executor = cls (work_dir = temp_dir , functions = [load_data ])
57
- code = f"""from { cls . FUNCTIONS_MODULE } import load_data
57
+ code = f"""from { executor . functions_module } import load_data
58
58
import pandas
59
59
60
60
# Get first row's name
@@ -74,7 +74,7 @@ def test_can_load_function_with_reqs(cls) -> None:
74
74
def test_can_load_function (cls ) -> None :
75
75
with tempfile .TemporaryDirectory () as temp_dir :
76
76
executor = cls (work_dir = temp_dir , functions = [add_two_numbers ])
77
- code = f"""from { cls . FUNCTIONS_MODULE } import add_two_numbers
77
+ code = f"""from { executor . functions_module } import add_two_numbers
78
78
print(add_two_numbers(1, 2))"""
79
79
80
80
result = executor .execute_code_blocks (
@@ -93,7 +93,7 @@ def test_can_load_function(cls) -> None:
93
93
# def test_fails_for_missing_reqs(cls) -> None:
94
94
# with tempfile.TemporaryDirectory() as temp_dir:
95
95
# executor = cls(work_dir=temp_dir, functions=[function_missing_reqs])
96
- # code = f"""from {cls.FUNCTIONS_MODULE } import function_missing_reqs
96
+ # code = f"""from {executor.functions_module } import function_missing_reqs
97
97
# function_missing_reqs()"""
98
98
99
99
# with pytest.raises(ValueError):
@@ -109,7 +109,7 @@ def test_can_load_function(cls) -> None:
109
109
def test_fails_for_function_incorrect_import (cls ) -> None :
110
110
with tempfile .TemporaryDirectory () as temp_dir :
111
111
executor = cls (work_dir = temp_dir , functions = [function_incorrect_import ])
112
- code = f"""from { cls . FUNCTIONS_MODULE } import function_incorrect_import
112
+ code = f"""from { executor . functions_module } import function_incorrect_import
113
113
function_incorrect_import()"""
114
114
115
115
with pytest .raises (ValueError ):
@@ -125,7 +125,7 @@ def test_fails_for_function_incorrect_import(cls) -> None:
125
125
def test_fails_for_function_incorrect_dep (cls ) -> None :
126
126
with tempfile .TemporaryDirectory () as temp_dir :
127
127
executor = cls (work_dir = temp_dir , functions = [function_incorrect_dep ])
128
- code = f"""from { cls . FUNCTIONS_MODULE } import function_incorrect_dep
128
+ code = f"""from { executor . functions_module } import function_incorrect_dep
129
129
function_incorrect_dep()"""
130
130
131
131
with pytest .raises (ValueError ):
@@ -183,7 +183,7 @@ def add_two_numbers(a: int, b: int) -> int:
183
183
)
184
184
185
185
executor = cls (work_dir = temp_dir , functions = [func ])
186
- code = f"""from { cls . FUNCTIONS_MODULE } import add_two_numbers
186
+ code = f"""from { executor . functions_module } import add_two_numbers
187
187
print(add_two_numbers(1, 2))"""
188
188
189
189
result = executor .execute_code_blocks (
@@ -219,10 +219,9 @@ def add_two_numbers(a: int, b: int) -> int:
219
219
'''
220
220
)
221
221
222
- code = f"""from { cls .FUNCTIONS_MODULE } import add_two_numbers
223
- print(add_two_numbers(object(), False))"""
224
-
225
222
executor = cls (work_dir = temp_dir , functions = [func ])
223
+ code = f"""from { executor .functions_module } import add_two_numbers
224
+ print(add_two_numbers(object(), False))"""
226
225
227
226
result = executor .execute_code_blocks (
228
227
code_blocks = [
0 commit comments