-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixtures.py
31 lines (28 loc) · 894 Bytes
/
fixtures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from util import *
import inspect
from differ import Differ
class ActionFixture(object):
def process(self, table):
for row in table.rows[1:]:
cells = RowIter(iter(row))
for cell in cells:
cell = cells.next()
f = getattr(self, str(cell))
nargs = len(inspect.getargspec(f)[0]) - 1
args = cells.get(nargs)
f(*args)
class DoFixture(object):
def process(self, table):
for row in table.rows[1:]:
cells = RowIter(iter(row))
name = ''
args = []
for cell in cells:
name += str(cell)
arg = ''
try:
args.append(str(cells.next()))
except StopIteration:
pass
f = getattr(self, name)
f(*args)