[Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate/tests - util.py:1.1.2.8.6.1
Jim Fulton
jim@zope.com
Fri, 26 Apr 2002 13:58:19 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv19482/tests
Modified Files:
Tag: SecurityProxy-branch
util.py
Log Message:
Changed "not" tests to use tal:condition rather than tal:content
so that they work with Python 2.3 as well as earlier versions.
The value returned from a not: is always boolean, which prints
differently from ints.
Also got rid of a stupid "OFS" import.
=== Zope3/lib/python/Zope/PageTemplate/tests/util.py 1.1.2.8 => 1.1.2.8.6.1 ===
s1 = normalize_html(s1)
s2 = normalize_html(s2)
- if s1!=s2:
- print
- from OFS.ndiff import SequenceMatcher, dump, IS_LINE_JUNK
- a = s1.split('\n')
- b = s2.split('\n')
- def add_nl(s):
- return s + '\n'
- a = map(add_nl, a)
- b = map(add_nl, b)
- cruncher=SequenceMatcher(isjunk=IS_LINE_JUNK, a=a, b=b)
- for tag, alo, ahi, blo, bhi in cruncher.get_opcodes():
- if tag == 'equal':
- continue
- print nicerange(alo, ahi) + tag[0] + nicerange(blo, bhi)
- dump('<', a, alo, ahi)
- if a and b:
- print '---'
- dump('>', b, blo, bhi)
- assert s1==s2, "HTML Output Changed"
+ assert s1==s2, (s1, s2, "HTML Output Changed")
def check_xml(s1, s2):
s1 = normalize_xml(s1)