Changeset 1645:a04dd0813cc9


Ignore:
Timestamp:
Jul 24, 2016, 11:09:37 PM (4 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
histedit_source:
df57299e94872d35b93f97208fda228885c5cade
rebase_source:
a619fd48c120cea563f3d3bf2b6b00dc0b4d1376
Message:
Change `assert...` methods to `assert` statements

ticket: 98
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test_error.py

    r1641 r1645  
    11# encoding: utf-8
    2 # Copyright (C) 2002-2014, Stefan Schwarzer <sschwarzer@sschwarzer.net>
     2# Copyright (C) 2002-2016, Stefan Schwarzer <sschwarzer@sschwarzer.net>
    33# and ftputil contributors (see `doc/contributors.txt`)
    44# See the file LICENSE for licensing terms.
     
    4343                self.callee()
    4444        except ftputil.error.FTPOSError as exc:
    45             self.assertFalse(exc.args and
    46                              isinstance(exc.args[0], ftplib.error_perm))
     45            assert not (exc.args and
     46                        isinstance(exc.args[0], ftplib.error_perm))
    4747        else:
    4848            # We shouldn't come here.
    49             self.fail()
     49            assert False
    5050
    5151    def test_ftplib_error_to_ftp_os_error_non_ascii_server_message(self):
     
    5656        # See ticket #77.
    5757        message = \
    58           ftputil.tool.as_bytes("Não é possível criar um arquivo já existente.")
     58          ftputil.tool.as_bytes(
     59            "Não é possível criar um arquivo já existente.")
    5960        try:
    6061            with ftputil.error.ftplib_error_to_ftp_os_error:
     
    6465            pass
    6566        except UnicodeDecodeError:
    66             self.fail()
     67            assert False
    6768
    6869    def test_ftplib_error_to_ftp_io_error(self):
     
    7576                self.callee()
    7677        except ftputil.error.FTPIOError as exc:
    77             self.assertFalse(exc.args and
    78                              isinstance(exc.args[0], ftplib.error_perm))
     78            assert not (exc.args and
     79                        isinstance(exc.args[0], ftplib.error_perm))
    7980        else:
    8081            # We shouldn't come here.
    81             self.fail()
     82            assert False
    8283
    8384    def test_error_message_reuse(self):
     
    9394            # The error message may be different for different Python
    9495            # versions.
    95             self.assertTrue(
     96            assert (
    9697              "No address associated with hostname" in str(exc) or
    9798              "Name or service not known" in str(exc))
Note: See TracChangeset for help on using the changeset viewer.