Esempio n. 1
0
    def __init__(self, name, **kwargs):
        self.name = name
        self.content = []
        self.string = '{begin}\n{content}\n{end}'

        self.begin = command('begin{{{name}}}'.format(name=self.name), **kwargs) 
        self.end   = command('end', arguments = [self.name], max_args=1, option_list=[])

        self.set_kwargs(**kwargs)
Esempio n. 2
0
args = ['arg1', 'arg2', 'arg3']

n = '\\test{o}{a}'
o = '['+','.join([str(i[0])+'='+str(i[1]) for i in opts.items()])+']'
a = '{arg1}{arg2}{arg3}'

print 'testing command'

count = 0
def fail():
    sys.exit('\ttest {0} failed'.format(count))

def succeed():
    print '\ttest successful'

tc = command('test')
count += 1
if not (tc.get_str() == n.format(o='',a='')):
    fail()

tc = command('test', options = opts)
count += 1
if not (tc.get_str() == n.format(o=o,a='')):
    fail()

tc = command('test', arguments = args)
count += 1
if not (tc.get_str() == n.format(o='',a=a)):
    fail()

tc = command('test', options = opts, arguments = args)