[Zope-Checkins] CVS: Zope/lib/python/ZPublisher/tests - testHTTPRangeSupport.py:1.6 testHTTPRequest.py:1.8 testTaintedString.py:1.2
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:09:41 -0400
Update of /cvs-repository/Zope/lib/python/ZPublisher/tests
In directory cvs.zope.org:/tmp/cvs-serv20811/tests
Modified Files:
testHTTPRangeSupport.py testHTTPRequest.py
testTaintedString.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/ZPublisher/tests/testHTTPRangeSupport.py 1.5 => 1.6 ===
--- Zope/lib/python/ZPublisher/tests/testHTTPRangeSupport.py:1.5 Wed Jun 12 16:39:20 2002
+++ Zope/lib/python/ZPublisher/tests/testHTTPRangeSupport.py Wed Aug 14 18:09:40 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import sys
@@ -22,7 +22,7 @@
def expectNone(self, header):
result = parseRange(header)
self.failUnless(result is None, 'Expected None, got %s' % `result`)
-
+
def expectSets(self, header, sets):
result = parseRange(header)
self.failUnless(result == sets,
@@ -62,12 +62,12 @@
def testOpenEnded(self):
self.expectSets('bytes=100-', [(100, None)])
-
+
def testStartEqualsEnd(self):
self.expectSets('bytes=100-100', [(100, 101)])
-
+
def testMultiple(self):
- self.expectSets('bytes=-100,,1-2,20-',
+ self.expectSets('bytes=-100,,1-2,20-',
[(-100, None), (1, 3), (20, None)])
def testFirstByte(self):
@@ -97,7 +97,7 @@
def testNoOverlapOutOfOrder(self):
self.expectSets([(1000, 2000), (3000, None), (1, 5)], 5000,
[(1, 5), (1000, 2000), (3000, 5000)])
-
+
def testOverlapInOrder(self):
self.expectSets([(1, 10), (8, 20), (25, None)], 5000,
[(1, 20), (25, 5000)])
@@ -136,10 +136,9 @@
def pdebug():
import pdb
pdb.run('debug()')
-
+
if __name__=='__main__':
if len(sys.argv) > 1:
globals()[sys.argv[1]]()
else:
main()
-
=== Zope/lib/python/ZPublisher/tests/testHTTPRequest.py 1.7 => 1.8 ===
--- Zope/lib/python/ZPublisher/tests/testHTTPRequest.py:1.7 Thu Aug 1 14:47:23 2002
+++ Zope/lib/python/ZPublisher/tests/testHTTPRequest.py Wed Aug 14 18:09:40 2002
@@ -29,7 +29,7 @@
for key, val in inputs:
add("%s=%s" % (quote_plus(key), quote_plus(val)))
query_string = '&'.join(query_string)
-
+
env = {'SERVER_NAME': 'testingharnas', 'SERVER_PORT': '80'}
env['QUERY_STRING'] = query_string
req = self._getHTTPRequest(env)
@@ -76,11 +76,11 @@
def _noFormValuesInOther(self, req):
for key in req.taintedform.keys():
- self.failIf(req.other.has_key(key),
+ self.failIf(req.other.has_key(key),
'REQUEST.other should not hold tainted values at first!')
-
+
for key in req.form.keys():
- self.failIf(req.other.has_key(key),
+ self.failIf(req.other.has_key(key),
'REQUEST.other should not hold form values at first!')
def _onlyTaintedformHoldsTaintedStrings(self, req):
@@ -126,7 +126,7 @@
def testSimpleMarshalling(self):
from DateTime import DateTime
-
+
inputs = (
('num:int', '42'), ('fract:float', '4.2'), ('bign:long', '45'),
('words:string', 'Some words'), ('2tokens:tokens', 'one two'),
@@ -159,7 +159,7 @@
('utext:utext:utf8', 'test\xc2\xae\ntest\xc2\xae\n'),
('utokens:utokens:utf8', 'test\xc2\xae test\xc2\xae'),
('ulines:ulines:utf8', 'test\xc2\xae\ntest\xc2\xae'),
-
+
('nouconverter:string:utf8', 'test\xc2\xae'))
req = self._processInputs(inputs)
@@ -194,7 +194,7 @@
formkeys.sort()
self.assertEquals(formkeys, ['alist', 'atuple', 'oneitem',
'oneitemtuple', 'onerec', 'setrec'])
-
+
self.assertEquals(req['oneitem'], ['one'])
self.assertEquals(req['oneitemtuple'], ('one',))
self.assertEquals(req['alist'], ['one', 'two'])
@@ -271,7 +271,7 @@
def testDefaults(self):
inputs = (
- ('foo:default:int', '5'),
+ ('foo:default:int', '5'),
('alist:int:default', '3'),
('alist:int:default', '4'),
@@ -356,10 +356,10 @@
('tinitutokens:utokens:utf8', '<test\xc2\xae> test\xc2\xae'),
('tinitulines:ulines:utf8', '<test\xc2\xae>\ntest\xc2\xae'),
-
+
('tdeferutokens:utokens:utf8', 'test\xc2\xae <test\xc2\xae>'),
('tdeferulines:ulines:utf8', 'test\xc2\xae\n<test\xc2\xae>'),
-
+
('tnouconverter:string:utf8', '<test\xc2\xae>'))
req = self._processInputs(inputs)
@@ -375,7 +375,7 @@
def testSimpleContainersWithTaints(self):
from types import ListType, TupleType
from ZPublisher.HTTPRequest import record
-
+
inputs = (
('toneitem:list', '<one>'),
('<tkeyoneitem>:list', 'one'),
@@ -472,8 +472,8 @@
def testDefaultsWithTaints(self):
inputs = (
- ('tfoo:default', '<5>'),
-
+ ('tfoo:default', '<5>'),
+
('doesnnotapply:default', '<4>'),
('doesnnotapply', '4'),
@@ -535,7 +535,7 @@
for type, convert in type_converters.items():
try:
convert('<html garbage>')
- except Exception, e:
+ except Exception, e:
self.failIf('<' in e.args,
'%s converter does not quote unsafe value!' % type)
except DateTime.SyntaxError, e:
@@ -556,7 +556,7 @@
self._noTaintedValues(req)
self._onlyTaintedformHoldsTaintedStrings(req)
-
+
def test_suite():
suite = unittest.TestSuite()
=== Zope/lib/python/ZPublisher/tests/testTaintedString.py 1.1 => 1.2 ===
--- Zope/lib/python/ZPublisher/tests/testTaintedString.py:1.1 Thu Aug 1 12:00:42 2002
+++ Zope/lib/python/ZPublisher/tests/testTaintedString.py Wed Aug 14 18:09:40 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import unittest
@@ -34,7 +34,7 @@
self.assertEquals(cmp(self.tainted, 'a'), -1)
self.assertEquals(cmp(self.tainted, '.'), 1)
- def testHash(self):
+ def testHash(self):
hash = {}
hash[self.tainted] = self.quoted
hash[self.unquoted] = self.unquoted
@@ -125,7 +125,7 @@
self.assert_(isinstance(part, self._getClass()))
for part in tainted.split():
self.failIf(isinstance(part, self._getClass()))
-
+
multiline = 'test\n<tainted>'
lines = self._getClass()(multiline).split()
self.assertEquals(lines, multiline.split())
@@ -158,10 +158,9 @@
def pdebug():
import pdb
pdb.run('debug()')
-
+
if __name__=='__main__':
if len(sys.argv) > 1:
globals()[sys.argv[1]]()
else:
main()
-