source: trunk/yaml/tests/TestYpath.py @ 87

Revision 87, 841 bytes checked in by tim, 9 years ago (diff)

moved tests into a module under yaml and added a testrunner script courtesy of matt goodall

  • Property svn:executable set to *
Line 
1import YamlTest
2import yaml
3from test import assertEquals
4
5class Test(YamlTest.YamlTest):
6    def testYpath(self):
7        try:   
8            for test in yaml.loadFile("./TestingSuite/ypath.yml"):
9                if not test.has_key('ignore'):
10                    expr = test['ypath']
11                    pth = yaml.ypath(expr,cntx=1)
12                    lst = [] 
13                    for x in pth.apply(test['data']):
14                        lst.append(str(x))
15                    exp = test['expected']
16                    if test.has_key('unordered'):
17                       lst.sort()
18                       exp.sort()
19                    assertEquals(lst,exp,expr + " => " + str(pth))
20        except NotImplementedError: 
21            assert()
22if __name__ == '__main__':
23    import unittest
24    unittest.main()
Note: See TracBrowser for help on using the repository browser.