Changeset 6cec675 in mod_gnutls


Ignore:
Timestamp:
Oct 8, 2020, 3:58:40 PM (7 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio
Children:
90d750d, b0f93c4
Parents:
60a415a
Message:

Fix remaining flake8 warnings in mgstest.tests

That's all, minus instances of "E722 do not use bare 'except'", which
I think is valid in certain cases (usually with a "raise" in the
handler block). :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/tests.py

    r60a415a r6cec675  
    253253        """
    254254        >>> r1 = TestRequest(path='/test.txt',
    255         ...                  expect={ 'headers': {'X-Forbidden-Header': None,
    256         ...                                       'X-Required-Header': 'Hi!' }})
     255        ...                  expect={'headers': {'X-Forbidden-Header': None,
     256        ...                                      'X-Required-Header': 'Hi!'}})
    257257        >>> r1.check_headers({ 'X-Required-Header': 'Hi!' })
    258258        >>> r1.check_headers({ 'X-Required-Header': 'Hello!' })
    259259        Traceback (most recent call last):
    260260        ...
    261         mgstest.TestExpectationFailed: Unexpected value in header X-Required-Header: 'Hello!', expected 'Hi!'
     261        mgstest.TestExpectationFailed: Unexpected value in header \
     262X-Required-Header: 'Hello!', expected 'Hi!'
    262263        >>> r1.check_headers({ 'X-Forbidden-Header': 'Hi!' })
    263264        Traceback (most recent call last):
    264265        ...
    265         mgstest.TestExpectationFailed: Unexpected value in header X-Forbidden-Header: 'Hi!', expected None
     266        mgstest.TestExpectationFailed: Unexpected value in header \
     267X-Forbidden-Header: 'Hi!', expected None
    266268        """
    267269        for name, expected in self.expect['headers'].items():
     
    275277    def check_body(self, body):
    276278        """
    277         >>> r1 = TestRequest(path='/test.txt', method='GET', headers={}, expect={'status': 200, 'body': {'exactly': 'test\\n'}})
     279        >>> r1 = TestRequest(path='/test.txt', method='GET', headers={}, \
     280expect={'status': 200, 'body': {'exactly': 'test\\n'}})
    278281        >>> r1.check_body('test\\n')
    279282        >>> r1.check_body('xyz\\n')
     
    281284        ...
    282285        mgstest.TestExpectationFailed: Unexpected body: 'xyz\\n' != 'test\\n'
    283         >>> r2 = TestRequest(path='/test.txt', method='GET', headers={}, expect={'status': 200, 'body': {'contains': ['tes', 'est']}})
     286        >>> r2 = TestRequest(path='/test.txt', method='GET', headers={}, \
     287expect={'status': 200, 'body': {'contains': ['tes', 'est']}})
    284288        >>> r2.check_body('test\\n')
    285289        >>> r2.check_body('est\\n')
    286290        Traceback (most recent call last):
    287291        ...
    288         mgstest.TestExpectationFailed: Unexpected body: 'est\\n' does not contain 'tes'
    289         >>> r3 = TestRequest(path='/test.txt', method='GET', headers={}, expect={'status': 200, 'body': {'contains': 'test'}})
     292        mgstest.TestExpectationFailed: Unexpected body: 'est\\n' \
     293does not contain 'tes'
     294        >>> r3 = TestRequest(path='/test.txt', method='GET', headers={}, \
     295expect={'status': 200, 'body': {'contains': 'test'}})
    290296        >>> r3.check_body('test\\n')
    291297        """
     
    300306                    self.expect['body']['contains']]
    301307            for s in self.expect['body']['contains']:
    302                 if not s in body:
     308                if s not in body:
    303309                    raise TestExpectationFailed(
    304310                        f'Unexpected body: {body!r} does not contain '
     
    323329        connection failed.
    324330
    325         >>> r1 = TestRequest(path='/test.txt', method='GET', headers={}, expect={'status': 200, 'body': {'contains': 'test'}})
     331        >>> r1 = TestRequest(path='/test.txt', method='GET', headers={}, \
     332expect={'status': 200, 'body': {'contains': 'test'}})
    326333        >>> r1.expects_conn_reset()
    327334        False
    328         >>> r2 = TestRequest(path='/test.txt', method='GET', headers={}, expect={'reset': True})
     335        >>> r2 = TestRequest(path='/test.txt', method='GET', headers={}, \
     336expect={'reset': True})
    329337        >>> r2.expects_conn_reset()
    330338        True
     
    444452
    445453    def run(self, conn, command):
    446         if not '--inline-commands' in command:
     454        if '--inline-commands' not in command:
    447455            raise ValueError('gnutls_params must include "inline-commands" '
    448456                             'to use the resume action!')
Note: See TracChangeset for help on using the changeset viewer.