Commit 493e7e26 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

py2/py3: stop using apply().

parent 126ae257
...@@ -116,7 +116,7 @@ class URLOpener(FancyURLopener): ...@@ -116,7 +116,7 @@ class URLOpener(FancyURLopener):
if auth: h.putheader('Authorization', 'Basic %s' % auth) if auth: h.putheader('Authorization', 'Basic %s' % auth)
if realhost: h.putheader('Host', realhost) if realhost: h.putheader('Host', realhost)
for args in self.addheaders: apply(h.putheader, args) for args in self.addheaders: h.putheader(*args)
h.endheaders() h.endheaders()
if data is not None: if data is not None:
h.send(data + '\r\n') h.send(data + '\r\n')
......
...@@ -75,18 +75,20 @@ class Python3StyleTest(ERP5TypeTestCase): ...@@ -75,18 +75,20 @@ class Python3StyleTest(ERP5TypeTestCase):
if error: if error:
self.fail(error) self.fail(error)
def test_raiseFixApplied(self): def test_applyFixApplied(self):
self._testFixer('raise') self._testFixer('apply')
def test_importFixApplied(self):
self._testFixer('import')
def test_hasKeyFixApplied(self): def test_hasKeyFixApplied(self):
self._testFixer('has_key') self._testFixer('has_key')
def test_importFixApplied(self):
self._testFixer('import')
def test_numliteralsFixApplied(self): def test_numliteralsFixApplied(self):
self._testFixer('numliterals') self._testFixer('numliterals')
def test_raiseFixApplied(self):
self._testFixer('raise')
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
...@@ -27,7 +27,7 @@ class TestField: ...@@ -27,7 +27,7 @@ class TestField:
class ValidatorTestCase(unittest.TestCase): class ValidatorTestCase(unittest.TestCase):
def assertValidatorRaises(self, exception, error_key, f, *args, **kw): def assertValidatorRaises(self, exception, error_key, f, *args, **kw):
try: try:
apply(f, args, kw) f(*args, **kw)
except exception as e: except exception as e:
if hasattr(e, 'error_key') and e.error_key != error_key: if hasattr(e, 'error_key') and e.error_key != error_key:
self.fail('Got wrong error. Expected %s received %s' % self.fail('Got wrong error. Expected %s received %s' %
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment