

def testFSMValue(self):
    line = 'Value beer (\\S+)'
    v = textfsm.TextFSMValue()
    v.Parse(line)
    self.failUnlessEqual(v.name, 'beer')
    self.failUnlessEqual(v.regex, '(\\S+)')
    self.failUnlessEqual(v.template, '(?P<beer>\\S+)')
    self.failIf(v.options)
    line = 'Value Filldown,Required beer (\\S+)'
    v = textfsm.TextFSMValue(options_class=textfsm.TextFSMOptions)
    v.Parse(line)
    self.failUnlessEqual(v.name, 'beer')
    self.failUnlessEqual(v.regex, '(\\S+)')
    self.failUnlessEqual(v.OptionNames(), ['Filldown', 'Required'])
    v = textfsm.TextFSMValue(options_class=textfsm.TextFSMOptions)
    v.Parse('Value Required beer (boo(hoo))')
    self.failUnlessEqual(v.name, 'beer')
    self.failUnlessEqual(v.regex, '(boo(hoo))')
    self.failUnlessEqual(v.template, '(?P<beer>boo(hoo))')
    self.failUnlessEqual(v.OptionNames(), ['Required'])
    self.failUnlessRaises(textfsm.TextFSMTemplateError, v.Parse, 'Value beer (boo(hoo)))boo')
    self.failUnlessRaises(textfsm.TextFSMTemplateError, v.Parse, 'Value beer boo(boo(hoo)))')
    self.failUnlessRaises(textfsm.TextFSMTemplateError, v.Parse, 'Value beer (boo)hoo)')
    v = textfsm.TextFSMValue(options_class=textfsm.TextFSMOptions)
    v.Parse('Value Required beer (boo(hoo))')
    self.failUnlessEqual(str(v), 'Value Required beer (boo(hoo))')
    v = textfsm.TextFSMValue(options_class=textfsm.TextFSMOptions)
    self.Parse('Value Required,Filldown beer (bo\\S+(hoo))')
    self.failUnlessEqual(str(v), 'Value Required,Filldown beer (bo\\S+(hoo))')

dataset/ETHPy150Open google/textfsm/textfsm_test.py UnitTestFSM.testFSMValue/VarMisuse@292/536 `v`->`self`