-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_execute_python.py
More file actions
36 lines (28 loc) · 1.15 KB
/
test_execute_python.py
File metadata and controls
36 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from test.utilities.env_vars import set_env_vars
from test.utilities.excel import Excel
def test_simple_script_for_addition(xll_addin_path):
with set_env_vars('basic_functions'):
with Excel() as excel:
excel.register_xll(xll_addin_path)
(
excel.new_workbook()
.range('A1').set(3.0)
.range('A2').set(4.0)
.range('B1').set_formula('=excelbind.execute_python("return arg0 + arg1", A1, A2)')
.calculate()
)
assert excel.range('B1').value == 7.0
print("done testing")
def test_combination_str_n_float(xll_addin_path):
with set_env_vars('basic_functions'):
with Excel() as excel:
excel.register_xll(xll_addin_path)
(
excel.new_workbook()
.range('A1').set("Hello times ")
.range('A2').set(3.0)
.range('B1').set_formula('=excelbind.execute_python("return arg0 + str(arg1)", A1, A2)')
.calculate()
)
assert excel.range('B1').value == 'Hello times 3.0'
print("done testing")