Mercurial > genshi > mirror
comparison markup/tests/path.py @ 179:13909179e5e1 trunk
Implemented support for XPath variables in predicates (#31).
author | cmlenz |
---|---|
date | Mon, 21 Aug 2006 17:25:19 +0000 |
parents | 1f6cb675a66c |
children | 94120e6b0ce4 |
comparison
equal
deleted
inserted
replaced
178:ba7556e3a835 | 179:13909179e5e1 |
---|---|
395 def test_predicate_true_function(self): | 395 def test_predicate_true_function(self): |
396 xml = XML('<root><foo>bar</foo></root>') | 396 xml = XML('<root><foo>bar</foo></root>') |
397 path = Path('*[true()]') | 397 path = Path('*[true()]') |
398 self.assertEqual('<foo>bar</foo>', path.select(xml).render()) | 398 self.assertEqual('<foo>bar</foo>', path.select(xml).render()) |
399 | 399 |
400 def test_predicate_variable(self): | |
401 xml = XML('<root><foo>bar</foo></root>') | |
402 path = Path('*[name()=$bar]') | |
403 variables = {'bar': 'foo'} | |
404 self.assertEqual('<foo>bar</foo>', path.select(xml, variables).render()) | |
405 | |
400 | 406 |
401 def suite(): | 407 def suite(): |
402 suite = unittest.TestSuite() | 408 suite = unittest.TestSuite() |
403 suite.addTest(doctest.DocTestSuite(Path.__module__)) | 409 suite.addTest(doctest.DocTestSuite(Path.__module__)) |
404 suite.addTest(unittest.makeSuite(PathTestCase, 'test')) | 410 suite.addTest(unittest.makeSuite(PathTestCase, 'test')) |