Ticket #6222: names-news-python-deprecate.patch

File names-news-python-deprecate.patch, 7.6 KB (added by Julian Berman, 9 years ago)
  • twisted/names/test/test_cache.py

    diff --git a/twisted/names/test/test_cache.py b/twisted/names/test/test_cache.py
    index 06245c3..fd3a7a4 100644
    a b class Caching(unittest.TestCase): 
    7575        clock.advance(1)
    7676
    7777        def cbLookup(result):
    78             self.assertEquals(result[0][0].ttl, 59)
    79             self.assertEquals(result[1][0].ttl, 49)
    80             self.assertEquals(result[2][0].ttl, 39)
    81             self.assertEquals(result[0][0].name.name, b"example.com")
     78            self.assertEqual(result[0][0].ttl, 59)
     79            self.assertEqual(result[1][0].ttl, 49)
     80            self.assertEqual(result[2][0].ttl, 39)
     81            self.assertEqual(result[0][0].name.name, b"example.com")
    8282
    8383        return c.lookupAddress(b"example.com").addCallback(cbLookup)
    8484
  • twisted/names/test/test_dns.py

    diff --git a/twisted/names/test/test_dns.py b/twisted/names/test/test_dns.py
    index 32635ef..8abae73 100644
    a b class MessageTestCase(unittest.SynchronousTestCase): 
    589589            b'\x00\x00' # number of additionals
    590590            )
    591591        self.assertEqual(msg.id, 256)
    592         self.failIf(msg.answer, "Message was not supposed to be an answer.")
     592        self.assertFalse(msg.answer, "Message was not supposed to be an answer.")
    593593        self.assertEqual(msg.opCode, dns.OP_QUERY)
    594         self.failIf(msg.auth, "Message was not supposed to be authoritative.")
    595         self.failIf(msg.trunc, "Message was not supposed to be truncated.")
     594        self.assertFalse(msg.auth, "Message was not supposed to be authoritative.")
     595        self.assertFalse(msg.trunc, "Message was not supposed to be truncated.")
    596596        self.assertEqual(msg.queries, [])
    597597        self.assertEqual(msg.answers, [])
    598598        self.assertEqual(msg.authority, [])
    class MessageTestCase(unittest.SynchronousTestCase): 
    615615        msg2 = dns.Message()
    616616        msg2.decode(s)
    617617
    618         self.failUnless(isinstance(msg2.answers[0].payload, dns.Record_NULL))
     618        self.assertTrue(isinstance(msg2.answers[0].payload, dns.Record_NULL))
    619619        self.assertEqual(msg2.answers[0].payload.payload, bytes)
    620620
    621621
  • twisted/names/test/test_names.py

    diff --git a/twisted/names/test/test_names.py b/twisted/names/test/test_names.py
    index 49ec40f..f57af5f 100644
    a b class HelperTestCase(unittest.TestCase): 
    507507        a = authority.getSerial(f)
    508508        for i in range(20):
    509509            b = authority.getSerial(f)
    510             self.failUnless(a < b)
     510            self.assertTrue(a < b)
    511511            a = b
    512512
    513513
  • twisted/news/test/test_news.py

    diff --git a/twisted/news/test/test_news.py b/twisted/news/test/test_news.py
    index 35ac7d7..922f661 100644
    a b class NewsTestCase(unittest.TestCase): 
    4040
    4141    def testArticleExists(self):
    4242        d = self.backend.articleExistsRequest(MESSAGE_ID)
    43         d.addCallback(self.failUnless)
     43        d.addCallback(self.assertTrue)
    4444        return d
    4545
    4646
    class NewsTestCase(unittest.TestCase): 
    4848        d = self.backend.articleRequest(None, None, MESSAGE_ID)
    4949
    5050        def cbArticle(result):
    51             self.failUnless(isinstance(result, tuple),
     51            self.assertTrue(isinstance(result, tuple),
    5252                            'callback result is wrong type: ' + str(result))
    5353            self.assertEqual(len(result), 3,
    5454                              'callback result list should have three entries: ' +
  • twisted/python/test/test_components.py

    diff --git a/twisted/python/test/test_components.py b/twisted/python/test/test_components.py
    index cc6905d..064b052 100644
    a b class ProxyForInterfaceTests(unittest.SynchronousTestCase): 
    771771        self.assertEqual(pd.__get__(fakeProxy), testObject.hello)
    772772        fakeClassMethod = pd.__get__(None)
    773773        fakeClassMethod(fakeProxy)
    774         self.failUnless(testObject.called)
     774        self.assertTrue(testObject.called)
    775775
    776776
    777777    def test_proxyInheritance(self):
    class ProxyForInterfaceTests(unittest.SynchronousTestCase): 
    811811        proxy = proxyClass(booable)
    812812        proxy.yay()
    813813        proxy.boo()
    814         self.failUnless(booable.yayed)
    815         self.failUnless(booable.booed)
     814        self.assertTrue(booable.yayed)
     815        self.assertTrue(booable.booed)
    816816
    817817
    818818    def test_attributeCustomization(self):
  • twisted/python/test/test_sendmsg.py

    diff --git a/twisted/python/test/test_sendmsg.py b/twisted/python/test/test_sendmsg.py
    index 48301f5..884cf44 100644
    a b class SendmsgTestCase(TestCase): 
    299299            send1msg(self.input.fileno(), message, 0))
    300300
    301301        result = recv1msg(fd=self.output.fileno())
    302         self.assertEquals(result, (message, 0, []))
     302        self.assertEqual(result, (message, 0, []))
    303303
    304304
    305305    def test_shortsend(self):
    class SendmsgTestCase(TestCase): 
    323323        send1msg(self.input.fileno(), "hello, world!", 0, [])
    324324
    325325        result = recv1msg(fd=self.output.fileno())
    326         self.assertEquals(result, ("hello, world!", 0, []))
     326        self.assertEqual(result, ("hello, world!", 0, []))
    327327
    328328
    329329    def test_flags(self):
    class SendmsgTestCase(TestCase): 
    356356        error = self.assertRaises(TypeError,
    357357                                  send1msg, self.input.fileno(),
    358358                                  "hello, world!", 0, 4321)
    359         self.assertEquals(str(error),
     359        self.assertEqual(str(error),
    360360                          "send1msg argument 3 expected list, got int")
    361361
    362362
    class SendmsgTestCase(TestCase): 
    402402
    403403        close(pipeIn)
    404404        yield sspp.stopped
    405         self.assertEquals(read(pipeOut, 1024), "Test fixture data: blonk.\n")
     405        self.assertEqual(read(pipeOut, 1024), "Test fixture data: blonk.\n")
    406406        # Make sure that the pipe is actually closed now.
    407         self.assertEquals(read(pipeOut, 1024), "")
     407        self.assertEqual(read(pipeOut, 1024), "")
    408408
    409409
    410410
  • twisted/python/test/test_util.py

    diff --git a/twisted/python/test/test_util.py b/twisted/python/test/test_util.py
    index 793704b..f0372a2 100644
    a b class UtilTestCase(unittest.TestCase): 
    3333        self.assertEqual(util.uniquify(l), ["a", 1, "ab", 3, 4, 2, 6])
    3434
    3535    def testRaises(self):
    36         self.failUnless(util.raises(ZeroDivisionError, divmod, 1, 0))
    37         self.failIf(util.raises(ZeroDivisionError, divmod, 0, 1))
     36        self.assertTrue(util.raises(ZeroDivisionError, divmod, 1, 0))
     37        self.assertFalse(util.raises(ZeroDivisionError, divmod, 0, 1))
    3838
    3939        try:
    4040            util.raises(TypeError, divmod, 1, 0)
    class OrderedDictTest(unittest.TestCase): 
    278278    def testInitialization(self):
    279279        d = util.OrderedDict({'monkey': 'ook',
    280280                              'apple': 'red'})
    281         self.failUnless(d._order)
     281        self.assertTrue(d._order)
    282282
    283283        d = util.OrderedDict(((1,1),(3,3),(2,2),(0,0)))
    284284        self.assertEqual(repr(d), "{1: 1, 3: 3, 2: 2, 0: 0}")
  • twisted/python/test/test_zipstream.py

    diff --git a/twisted/python/test/test_zipstream.py b/twisted/python/test/test_zipstream.py
    index b9d9a8a..cedc438 100644
    a b class ZipstreamTest(unittest.TestCase): 
    331331        # this could theoretically be any number but statistically it
    332332        # should always be in this range
    333333        approx = lower < r < upper
    334         self.failUnless(approx)
     334        self.assertTrue(approx)
    335335        for r in uziter:
    336336            pass
    337337        self.assertEqual(r, 0)