[Zope-dev] Re: SVN:
Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/testExpressions.py
Fix a test that was testing wrong behaviour: primitive types
Tres Seaver
tseaver at palladion.com
Mon May 22 16:13:02 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Philipp von Weitershausen wrote:
> Log message for revision 68244:
> Fix a test that was testing wrong behaviour: primitive types
> werent' called if they were the result of a path expression, while
> all other callables were called. This tests now tests the correct
> behaviour (which happens to be already implemented by the Zope 3
> TALES engine)
> + assert ec.evaluate('x | python:int') == 0
Wait a minute -- that isn't a path expression there! The '|' is not
supposed to change the rules for evaluation of the subexpressions! If
'int' or the like were somehow avaialbe at module scope, or via
'options' or another top-level name, then they should be called *when
they are the last item in a path expression*.
The test was actually correct beofore: because tne PathExpression, 'x',
raises, the PythonExpression, 'int', is evalutated. The result of a
subexpression is not suppoeed to be called,
> assert ec.evaluate('x | string:x') == 'x'
> assert ec.evaluate('x | string:$one') == '1'
> assert ec.evaluate('x | not:exists:x')
>
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEchs6+gerLs4ltQ4RAi9DAJ9X34bgQNfCq+RN4zj27OoU6/Et0QCfbEDn
IYaH04TINHsOQk36f2f19do=
=eW90
-----END PGP SIGNATURE-----
More information about the Zope-Dev
mailing list