How to use props_by_states method in fMBT

Best Python code snippet using fMBT_python

lsts.py

Source:lsts.py Github

copy

Full Screen

...63example, if string s contains an LSTS64r=lsts.reader(fakefile(s))65r.read()66reads the LSTS in s.67props_by_states(lsts_object) returns table indexed with state68numbers. The table includes lists of state proposition numbers. For69example,70props_by_states(r)[42]71returns list of numbers of propositions true in state 42. To convert72the number of a state proposition to a name, index alphabetically73ordered list of state proposition keys with it:74stateproplist=r.get_stateprops().keys()75stateproplist.sort()76name_of_prop=stateproplist[num_of_a_stateprop]77"""78version="0.522 svn"79# 0.490 -> 0.522 support for dos lines (carriage returns are removed)80# 0.110 -> 0.490 support for multirow action names81# 0.55 -> 0.110 lsts file objects can be read and written already in82# the constructor.83# 0.53 -> 0.55 stateprops numbered in the order of occurence in the lsts file84# (alphabetical order). Documentation changed accordingly.85# 0.52 -> 0.53 bugfix: state props numbered off-by-one86# 0.52 -> 0.53 bugfix: reading multi-line transitions and state props87# 0.52 -> 0.53 props_by_states-helper function88# 0.52 -> 0.53 psyco is used if possible89# 0.50 -> 0.52 added support for state prop ranges "x..y"90from sys import stderr91class fakefile:92 """93 fakefile(string) is a file-like object that contains the94 string. It implements readline and write methods and nothing else.95 This class can be used as input and output file of the reader and96 the writer classes. The contents of the file are in attribute s.97 """98 def __init__(self,lstscontents):99 self.s=lstscontents100 def readline(self):101 l=self.s[:self.s.find("\n")+1]102 self.s=self.s[self.s.find("\n")+1:]103 return l104 def write(self,s):105 self.s+=s106def props_by_states(lsts_object):107 """props_by_states(lsts_object) -> state_table108 If propositions x and y (and no other propositions) are true in109 state s, then state_table[s]==[x,y]. s, x and y are natural110 numbers. To obtain the name of the proposition x, use111 stateproplist=r.get_stateprops().keys()112 stateproplist.sort()113 name_of_prop=stateproplist[num_of_a_stateprop]114 """115 statetbl=[ [] for x in xrange(lsts_object.get_header().state_cnt)]116 propdict=lsts_object.get_stateprops()117 propkeys = propdict.keys()118 propkeys.sort()119 for propindex,prop in enumerate(propkeys):120 for state in propdict[prop]:121 statetbl[state].append(propindex)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful