@@ -80,6 +80,31 @@ def test_python_compiler_amd64(
8080 def test_c_value_to_py (self ):
8181 self .assertIsNone (excelize .c_value_to_py (None , None ))
8282
83+ def test_calc_props (self ):
84+ f = excelize .new_file ()
85+ opts = excelize .CalcPropsOptions (
86+ full_calc_on_load = True ,
87+ calc_id = 122211 ,
88+ concurrent_manual_count = 5 ,
89+ iterate_count = 10 ,
90+ concurrent_calc = True ,
91+ )
92+ self .assertIsNone (f .set_calc_props (opts ))
93+ with self .assertRaises (TypeError ) as context :
94+ f .set_calc_props (0 )
95+ self .assertEqual (
96+ str (context .exception ),
97+ "expected type CalcPropsOptions for argument 'opts', but got int" ,
98+ )
99+ with self .assertRaises (RuntimeError ) as context :
100+ f .set_calc_props (excelize .CalcPropsOptions (ref_mode = "a1" ))
101+ self .assertEqual (
102+ str (context .exception ),
103+ 'invalid RefMode value "a1", acceptable value should be one of A1, R1C1' ,
104+ )
105+ self .assertEqual (opts , f .get_calc_props ())
106+ self .assertIsNone (f .close ())
107+
83108 def test_py_value_to_c (self ):
84109 self .assertIsNone (excelize .py_value_to_c (None , None ))
85110
@@ -901,6 +926,9 @@ def test_none_file_pointer(self):
901926 with self .assertRaises (RuntimeError ) as context :
902927 f .get_defined_name ()
903928 self .assertEqual (str (context .exception ), expected )
929+ with self .assertRaises (RuntimeError ) as context :
930+ f .get_calc_props ()
931+ self .assertEqual (str (context .exception ), expected )
904932 with self .assertRaises (RuntimeError ) as context :
905933 f .get_sheet_name (0 )
906934 self .assertEqual (str (context .exception ), expected )
@@ -2230,7 +2258,7 @@ def test_doc_props(self):
22302258 def test_join_cell_name (self ):
22312259 self .assertEqual (excelize .join_cell_name ("A" , 1 ), "A1" )
22322260 with self .assertRaises (RuntimeError ) as context :
2233- excelize .join_cell_name ("" , 0 )
2261+ excelize .join_cell_name ("" , 0 )
22342262 self .assertEqual (str (context .exception ), 'invalid column name ""' )
22352263 with self .assertRaises (TypeError ) as context :
22362264 excelize .join_cell_name (1 , 1 )
0 commit comments