Skip to content

Commit 3c3c45c

Browse files
committed
fix test deprecation warnings
1 parent c7aaf7a commit 3c3c45c

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

fs/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ def test_remove(self):
10611061
self.fs.makedirs("foo/bar/baz/")
10621062

10631063
error_msg = "resource 'foo/bar/egg/test.txt' not found"
1064-
with self.assertRaisesRegexp(errors.ResourceNotFound, error_msg):
1064+
with self.assertRaisesRegex(errors.ResourceNotFound, error_msg):
10651065
self.fs.remove("foo/bar/egg/test.txt")
10661066

10671067
def test_removedir(self):

tests/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from fs import errors
99

1010

11-
class TestFS(FS):
11+
class DummyFS(FS):
1212
def getinfo(self, path, namespaces=None):
1313
pass
1414

@@ -33,7 +33,7 @@ def setinfo(self, path, info):
3333

3434
class TestBase(unittest.TestCase):
3535
def setUp(self):
36-
self.fs = TestFS()
36+
self.fs = DummyFS()
3737

3838
def test_validatepath(self):
3939
"""Test validatepath method."""

tests/test_iotools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_make_stream(self):
2626

2727
with self.fs.openbin("foo.bin") as f:
2828
data = f.read()
29-
self.assert_(isinstance(data, bytes))
29+
self.assertTrue(isinstance(data, bytes))
3030

3131
with self.fs.openbin("text.txt", "wb") as f:
3232
f.write(UNICODE_TEXT.encode("utf-8"))

tests/test_path.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ def test_splitext(self):
152152
self.assertEqual(splitext(".foo"), (".foo", ""))
153153

154154
def test_recursepath(self):
155-
self.assertEquals(recursepath("/"), ["/"])
156-
self.assertEquals(recursepath("hello"), ["/", "/hello"])
157-
self.assertEquals(recursepath("/hello/world/"), ["/", "/hello", "/hello/world"])
158-
self.assertEquals(
155+
self.assertEqual(recursepath("/"), ["/"])
156+
self.assertEqual(recursepath("hello"), ["/", "/hello"])
157+
self.assertEqual(recursepath("/hello/world/"), ["/", "/hello", "/hello/world"])
158+
self.assertEqual(
159159
recursepath("/hello/world/", reverse=True), ["/hello/world", "/hello", "/"]
160160
)
161-
self.assertEquals(recursepath("hello", reverse=True), ["/hello", "/"])
162-
self.assertEquals(recursepath("", reverse=True), ["/"])
161+
self.assertEqual(recursepath("hello", reverse=True), ["/hello", "/"])
162+
self.assertEqual(recursepath("", reverse=True), ["/"])
163163

164164
def test_isbase(self):
165165
self.assertTrue(isbase("foo", "foo/bar"))
@@ -178,7 +178,7 @@ def test_issamedir(self):
178178

179179
def test_isdotfile(self):
180180
for path in [".foo", ".svn", "foo/.svn", "foo/bar/.svn", "/foo/.bar"]:
181-
self.assert_(isdotfile(path))
181+
self.assertTrue(isdotfile(path))
182182

183183
for path in ["asfoo", "df.svn", "foo/er.svn", "foo/bar/test.txt", "/foo/bar"]:
184184
self.assertFalse(isdotfile(path))
@@ -201,10 +201,10 @@ def test_basename(self):
201201
self.assertEqual(basename(path), test_basename)
202202

203203
def test_iswildcard(self):
204-
self.assert_(iswildcard("*"))
205-
self.assert_(iswildcard("*.jpg"))
206-
self.assert_(iswildcard("foo/*"))
207-
self.assert_(iswildcard("foo/{}"))
204+
self.assertTrue(iswildcard("*"))
205+
self.assertTrue(iswildcard("*.jpg"))
206+
self.assertTrue(iswildcard("foo/*"))
207+
self.assertTrue(iswildcard("foo/{}"))
208208
self.assertFalse(iswildcard("foo"))
209209
self.assertFalse(iswildcard("img.jpg"))
210210
self.assertFalse(iswildcard("foo/bar"))

0 commit comments

Comments
 (0)