From ce7e4b754cef39174804aa68fbff27edf7ffa0a9 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 8 Nov 2021 21:10:51 +0100 Subject: [PATCH] Replace deprecated unittest function calls. --- plugins/Admin/test.py | 6 +++--- test/test_irclib.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/Admin/test.py b/plugins/Admin/test.py index a8a9c6954..92ae557c2 100644 --- a/plugins/Admin/test.py +++ b/plugins/Admin/test.py @@ -71,7 +71,7 @@ class AdminTestCase(PluginTestCase): ircdb.users.setUser(u) self.assertNotError('capability add foo bar') self.assertError('addcapability foo baz') - self.assert_('bar' in u.capabilities) + self.assertIn('bar', u.capabilities) ircdb.users.delUser(u.id) def testCapabilityRemove(self): @@ -80,10 +80,10 @@ class AdminTestCase(PluginTestCase): u.name = 'foo' ircdb.users.setUser(u) self.assertNotError('capability add foo bar') - self.assert_('bar' in u.capabilities) + self.assertIn('bar', u.capabilities) self.assertError('removecapability foo bar') self.assertNotError('capability remove foo bar') - self.assert_(not 'bar' in u.capabilities) + self.assertNotIn('bar', u.capabilities) ircdb.users.delUser(u.id) def testJoin(self): diff --git a/test/test_irclib.py b/test/test_irclib.py index cfb15f8fd..cb020373b 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -528,7 +528,7 @@ class IrcStateTestCase(SupyTestCase): def testDoModeOnlyChannels(self): st = irclib.IrcState() - self.assert_(st.addMsg(self.irc, ircmsgs.IrcMsg('MODE foo +i')) or 1) + self.assertTrue(st.addMsg(self.irc, ircmsgs.IrcMsg('MODE foo +i')) or 1) def testNamreply(self): """RPL_NAMREPLY / reply to NAMES""" @@ -740,14 +740,14 @@ class StsTestCase(SupyTestCase): self.irc = irclib.Irc('test') m = self.irc.takeMsg() - self.failUnless(m.command == 'CAP', 'Expected CAP, got %r.' % m) - self.failUnless(m.args == ('LS', '302'), 'Expected CAP LS 302, got %r.' % m) + self.assertEqual(m.command, 'CAP', 'Expected CAP, got %r.' % m) + self.assertEqual(m.args, ('LS', '302'), 'Expected CAP LS 302, got %r.' % m) m = self.irc.takeMsg() - self.failUnless(m.command == 'NICK', 'Expected NICK, got %r.' % m) + self.assertEqual(m.command, 'NICK', 'Expected NICK, got %r.' % m) m = self.irc.takeMsg() - self.failUnless(m.command == 'USER', 'Expected USER, got %r.' % m) + self.assertEqual(m.command, 'USER', 'Expected USER, got %r.' % m) self.irc.driver = unittest.mock.Mock()