@@ -415,5 +415,57 @@ def _verify_cell_info(self, row, col, contenttype, celltype, macro=None):
415415 assert cell_info .content_type == contenttype
416416
417417
418+
419+ class TestEmbeddedCellInfo (unittest .TestCase ):
420+
421+ @classmethod
422+ def setUpClass (cls ):
423+ cls .project_ctrl = datafilereader .construct_project (datafilereader .EMBEDDED_PROJECT )
424+ # print(f"DEBUG: TestEmbeddedCellInfo setUpClass project_ctrl: {cls.project_ctrl.display_name}"
425+ # f" {cls.project_ctrl.datafiles}")
426+ cls .testsuite = cls .project_ctrl .datafiles [0 ]
427+ cls .test1 = cls .testsuite .tests [0 ]
428+ cls .test2 = cls .testsuite .tests [1 ]
429+
430+ @classmethod
431+ def tearDownClass (cls ):
432+ cls .project_ctrl .close ()
433+
434+ def test_var_and_kw (self ):
435+ # print("DEBUG: test_var_and_kw:")
436+ # for s in self.test1.steps:
437+ # print(f"{s.as_list()}")
438+ self ._verify_cell_info (0 , 0 , ContentType .LIBRARY_KEYWORD , CellType .KEYWORD , self .test1 )
439+ self ._verify_cell_info (0 , 1 , ContentType .UNKNOWN_VARIABLE , CellType .OPTIONAL , self .test1 )
440+ self ._verify_cell_info (0 , 2 , ContentType .STRING , CellType .OPTIONAL , self .test1 )
441+ self ._verify_cell_info (1 , 0 , ContentType .USER_KEYWORD , CellType .KEYWORD , self .test1 )
442+ self ._verify_cell_info (2 , 0 , ContentType .USER_KEYWORD , CellType .KEYWORD , self .test1 )
443+ # This was at TearDown
444+ self .test1 .execute (delete_rows ([i for i in range (len (self .test1 .steps ))]))
445+
446+ def test_var_and_kw_prefix_resource (self ):
447+ # print("DEBUG: test_var_and_kw:")
448+ # for s in self.test2.steps:
449+ # print(f"{s.as_list()}")
450+ self ._verify_cell_info (0 , 0 , ContentType .LIBRARY_KEYWORD , CellType .KEYWORD , self .test2 )
451+ self ._verify_cell_info (0 , 1 , ContentType .UNKNOWN_VARIABLE , CellType .OPTIONAL , self .test2 )
452+ self ._verify_cell_info (0 , 2 , ContentType .STRING , CellType .OPTIONAL , self .test2 )
453+ self ._verify_cell_info (1 , 0 , ContentType .USER_KEYWORD , CellType .KEYWORD , self .test2 )
454+ self ._verify_cell_info (2 , 0 , ContentType .LIBRARY_KEYWORD , CellType .KEYWORD , self .test2 )
455+ self ._verify_cell_info (2 , 1 , ContentType .UNKNOWN_VARIABLE , CellType .OPTIONAL , self .test2 )
456+ self ._verify_cell_info (2 , 2 , ContentType .STRING , CellType .OPTIONAL , self .test2 )
457+ self ._verify_cell_info (3 , 0 , ContentType .USER_KEYWORD , CellType .KEYWORD , self .test2 )
458+ self ._verify_cell_info (3 , 1 , ContentType .VARIABLE , CellType .MANDATORY , self .test2 )
459+ # This was at TearDown
460+ self .test2 .execute (delete_rows ([i for i in range (len (self .test2 .steps ))]))
461+
462+ @staticmethod
463+ def _verify_cell_info (row , col , contenttype , celltype , macro = None ):
464+ cell_info = macro .get_cell_info (row , col )
465+ # print(f"DEBUG:test_cellinfo type cell_type{cell_info.cell_type} content_type{cell_info.content_type}")
466+ assert cell_info .cell_type == celltype
467+ assert cell_info .content_type == contenttype
468+
469+
418470if __name__ == "__main__" :
419471 unittest .main ()
0 commit comments