

def testValidateFSM(self):
    f = cStringIO.StringIO('\nNotStart\n')
    self.failUnlessRaises(textfsm.TextFSMTemplateError, textfsm.TextFSM, f)
    f = cStringIO.StringIO('Value unused (.)\n\n')
    self.failUnlessRaises(textfsm.TextFSMTemplateError, textfsm.TextFSM, f)
    f = cStringIO.StringIO('Value unused (.)\n\nNotStart\n')
    self.failUnlessRaises(textfsm.TextFSMTemplateError, textfsm.TextFSM, f)
    f = cStringIO.StringIO('Value unused (.)\n\nStart\n')
    t = textfsm.TextFSM(f)
    t.states['Start'] = []
    t.states['Start'].append(textfsm.TextFSMRule('^.* -> Start'))
    t._ValidateFSM()
    self.states['Start'].append(textfsm.TextFSMRule('^.* -> bogus'))
    self.failUnlessRaises(textfsm.TextFSMTemplateError, t._ValidateFSM)
    t.states['bogus'] = []
    t.states['bogus'].append(textfsm.TextFSMRule('^.* -> Start'))
    t._ValidateFSM()
    t.states['bogus'] = []
    t.states['bogus'].append(textfsm.TextFSMRule('^.* -> Next.Record Start'))
    t._ValidateFSM()
    t.states['bogus'] = []
    t.states['bogus'].append(textfsm.TextFSMRule('^.* -> Error'))
    t._ValidateFSM()
    t.states['bogus'].append(textfsm.TextFSMRule('^.* -> Error "Boo hoo"'))
    t._ValidateFSM()

dataset/ETHPy150Open google/textfsm/textfsm_test.py UnitTestFSM.testValidateFSM/VarMisuse@133/242 `t`->`self`