summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2023-03-04 15:53:29 +0100
committerMarcel Hellkamp <marc@gsites.de>2023-03-04 16:32:26 +0100
commitc04c794ca9b8004ae3156c7ccef1255b31afa495 (patch)
tree1a3d4f6c0301badaf1e9e9c492dd1cd6bf45577b
parent486898d0bc16b21f1db95529369644f14399b89b (diff)
downloadbottle-c04c794ca9b8004ae3156c7ccef1255b31afa495.tar.gz
Reduce deprectation warnings during tests
-rw-r--r--test/test_config.py8
-rwxr-xr-xtest/test_environ.py4
-rw-r--r--test/test_importhook.py4
-rw-r--r--test/test_plugins.py2
-rwxr-xr-xtest/test_stpl.py2
-rwxr-xr-xtest/test_wsgi.py2
6 files changed, 11 insertions, 11 deletions
diff --git a/test/test_config.py b/test/test_config.py
index ee9ec61..e8efaa0 100644
--- a/test/test_config.py
+++ b/test/test_config.py
@@ -29,16 +29,16 @@ class TestConfDict(unittest.TestCase):
c['bool'] = 'I am so true!'
c['int'] = '6'
self.assertTrue(c['bool'] is True)
- self.assertEquals(c['int'], 6)
+ self.assertEqual(c['int'], 6)
self.assertRaises(ValueError, lambda: c.update(int='not an int'))
def test_load_dict(self):
c = ConfigDict()
d = dict(a=dict(b=dict(foo=5, bar=6), baz=7))
c.load_dict(d)
- self.assertEquals(c['a.b.foo'], 5)
- self.assertEquals(c['a.b.bar'], 6)
- self.assertEquals(c['a.baz'], 7)
+ self.assertEqual(c['a.b.foo'], 5)
+ self.assertEqual(c['a.b.bar'], 6)
+ self.assertEqual(c['a.baz'], 7)
if __name__ == '__main__': #pragma: no cover
unittest.main()
diff --git a/test/test_environ.py b/test/test_environ.py
index 8e96fc9..e0065c7 100755
--- a/test/test_environ.py
+++ b/test/test_environ.py
@@ -299,7 +299,7 @@ class TestRequest(unittest.TestCase):
e['wsgi.input'].seek(0)
e['HTTP_TRANSFER_ENCODING'] = 'chunked'
if isinstance(expect, str):
- self.assertEquals(tob(expect), BaseRequest(e).body.read())
+ self.assertEqual(tob(expect), BaseRequest(e).body.read())
else:
self.assertRaises(expect, lambda: BaseRequest(e).body)
@@ -581,7 +581,7 @@ class TestResponse(unittest.TestCase):
def test_content_type(self):
rs = BaseResponse()
rs.content_type = 'test/some'
- self.assertEquals('test/some', rs.headers.get('Content-Type'))
+ self.assertEqual('test/some', rs.headers.get('Content-Type'))
def test_charset(self):
rs = BaseResponse()
diff --git a/test/test_importhook.py b/test/test_importhook.py
index 234fda4..7c2a02c 100644
--- a/test/test_importhook.py
+++ b/test/test_importhook.py
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import unittest
import sys, os
-import imp
+from bottle import new_module
class TestImportHooks(unittest.TestCase):
def make_module(self, name, **args):
- mod = sys.modules.setdefault(name, imp.new_module(name))
+ mod = sys.modules.setdefault(name, new_module(name))
mod.__file__ = '<virtual %s>' % name
mod.__dict__.update(**args)
return mod
diff --git a/test/test_plugins.py b/test/test_plugins.py
index aec5042..f2da3f9 100644
--- a/test/test_plugins.py
+++ b/test/test_plugins.py
@@ -194,7 +194,7 @@ class TestPluginAPI(tools.ServerTestBase):
def __call__(self, func): return func
def setup(self, app): self.app = app
plugin = self.app.install(Plugin())
- self.assertEquals(getattr(plugin, 'app', None), self.app)
+ self.assertEqual(getattr(plugin, 'app', None), self.app)
def test_close(self):
class Plugin(object):
diff --git a/test/test_stpl.py b/test/test_stpl.py
index 32b53be..2c25ffb 100755
--- a/test/test_stpl.py
+++ b/test/test_stpl.py
@@ -54,7 +54,7 @@ class TestSimpleTemplate(unittest.TestCase):
self.assertRenders('<{{var}}>', '<[1, 2]>', var=[1,2])
def test_htmlutils_quote(self):
- self.assertEquals('"&lt;&#039;&#13;&#10;&#9;&quot;\\&gt;"', html_quote('<\'\r\n\t"\\>'));
+ self.assertEqual('"&lt;&#039;&#13;&#10;&#9;&quot;\\&gt;"', html_quote('<\'\r\n\t"\\>'));
def test_escape(self):
self.assertRenders('<{{var}}>', '<b>', var='b')
diff --git a/test/test_wsgi.py b/test/test_wsgi.py
index 973ae8e..46ff332 100755
--- a/test/test_wsgi.py
+++ b/test/test_wsgi.py
@@ -257,7 +257,7 @@ class TestRouteDecorator(ServerTestBase):
def test_name(self):
@bottle.route(name='foo')
def test(x=5): return 'ok'
- self.assertEquals('/test/6', bottle.url('foo', x=6))
+ self.assertEqual('/test/6', bottle.url('foo', x=6))
def test_callback(self):
def test(x=5): return str(x)