Best Python code snippet using fMBT_python
lsts.py
Source:lsts.py  
...166        self._header.state_cnt=len(transitions)167        self._header.transition_cnt=0168        for s in transitions:169            self._header.transition_cnt+=len(s)170    def set_stateprops(self,stateprops):171        """172        Parameters:173        - stateprops should be a dictionary whose keys are state174          proposition names and values are lists of state numbers.175        Notes:176        This method modifies State_prop_cnt field in the header.177        """178        self._stateprops=stateprops179        self._header.state_prop_cnt=len(self._stateprops)180    def set_layout(self,layout):181        """182        Parameters:183        - layout should be a list of pairs (xcoord, ycoord), indexed184          with state numbers.185        """186        self._layout=layout187    def get_actionnames(self):188        return self._actionnames189    def get_transitions(self):190        return self._transitions191    def get_stateprops(self):192        return self._stateprops193    def get_layout(self):194        return self._layout195    def get_history(self):196        return self._history197    def get_header(self):198        return self._header199class writer(lsts):200    """201    LSTS writer class202    """203    def __init__(self,file=None,lsts_object=None):204        """205        Parameters:206        - Optional parameter 'file' should provide method207        'write'. Output will be written to this object. Valid objects208        are, for example, files opened for writing and sys.stdout.209        - Optional parameter lsts_object should be an instance of lsts210         (or reader or writer) class. New header will be automatically211         generated based on action names and transitions of the lsts212         object.213        - If both optional arguments are provided, the lsts object is214          immediately written to the file. In this case, for backward215          compatibility, the first call of write method will not do216          anything the writing target is the same file object.217        """218        self._written_in_constructor=None # this file has been written219        lsts.__init__(self)220        self.__file=file221        if isinstance(lsts_object,lsts):222            self.set_actionnames( lsts_object.get_actionnames() )223            self.set_transitions( lsts_object.get_transitions() )224            self.set_stateprops( lsts_object.get_stateprops() )225            self.set_layout( lsts_object.get_layout() )226            self._header.initial_states=lsts_object.get_header().initial_states227        if file!=None and lsts_object!=None: # write immediately228            self.write()229            self._written_in_constructor=file230    def write(self,file=None,stateprop_order=None):231        """232        Parameters:233        - optional parameter file is the same as in __init__.234        Notes:235        Writes all lsts information to the given file object.236        """237        if not file:238            file=self.__file...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
