Skip to content

Commit 75d0b89

Browse files
author
boris
committed
ran pyupgrade-docs again
1 parent 7f90e74 commit 75d0b89

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

doc/en/example/parametrize.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ only have to work a bit to construct the correct arguments for pytest's
190190
idlist.append(scenario[0])
191191
items = scenario[1].items()
192192
argnames = [x[0] for x in items]
193-
argvalues.append(([x[1] for x in items]))
193+
argvalues.append([x[1] for x in items])
194194
metafunc.parametrize(argnames, argvalues, ids=idlist, scope="class")
195195
196196
scenario1 = ('basic', {'attribute': 'value'})
197197
scenario2 = ('advanced', {'attribute': 'value2'})
198198
199-
class TestSampleWithScenarios(object):
199+
class TestSampleWithScenarios:
200200
scenarios = [scenario1, scenario2]
201201
202202
def test_demo1(self, attribute):
@@ -277,9 +277,9 @@ creates a database object for the actual test invocations::
277277
if 'db' in metafunc.fixturenames:
278278
metafunc.parametrize("db", ['d1', 'd2'], indirect=True)
279279
280-
class DB1(object):
280+
class DB1:
281281
"one database object"
282-
class DB2(object):
282+
class DB2:
283283
"alternative database object"
284284
285285
@pytest.fixture
@@ -398,7 +398,7 @@ parametrizer`_ but in a lot less code::
398398
metafunc.parametrize(argnames, [[funcargs[name] for name in argnames]
399399
for funcargs in funcarglist])
400400
401-
class TestClass(object):
401+
class TestClass:
402402
# a map specifying multiple argument sets for a test method
403403
params = {
404404
'test_equals': [dict(a=1, b=2), dict(a=3, b=3), ],

doc/en/example/pythoncollection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ that match ``*_check``. For example, if we have::
136136
.. code-block:: python
137137
138138
# content of check_myapp.py
139-
class CheckMyApp(object):
139+
class CheckMyApp:
140140
def simple_check(self):
141141
pass
142142
def complex_check(self):

doc/en/example/special.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ calls it::
1616
@pytest.fixture(scope="session", autouse=True)
1717
def callattr_ahead_of_alltests(request):
1818
print("callattr_ahead_of_alltests called")
19-
seen = set([None])
19+
seen = {None}
2020
session = request.node
2121
for item in session.items:
2222
cls = item.getparent(pytest.Class)
@@ -32,7 +32,7 @@ will be called ahead of running any tests::
3232
3333
# content of test_module.py
3434
35-
class TestHello(object):
35+
class TestHello:
3636
@classmethod
3737
def callme(cls):
3838
print("callme called!")
@@ -43,7 +43,7 @@ will be called ahead of running any tests::
4343
def test_method2(self):
4444
print("test_method1 called")
4545
46-
class TestOther(object):
46+
class TestOther:
4747
@classmethod
4848
def callme(cls):
4949
print("callme other called")

doc/en/fixture.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ read an optional server URL from the test module which uses our fixture::
496496
server = getattr(request.module, "smtpserver", "smtp.gmail.com")
497497
smtp_connection = smtplib.SMTP(server, 587, timeout=5)
498498
yield smtp_connection
499-
print("finalizing %s (%s)" % (smtp_connection, server))
499+
print("finalizing {} ({})".format(smtp_connection, server))
500500
smtp_connection.close()
501501
502502
We use the ``request.module`` attribute to optionally obtain an
@@ -820,7 +820,7 @@ and instantiate an object ``app`` where we stick the already defined
820820
821821
import pytest
822822
823-
class App(object):
823+
class App:
824824
def __init__(self, smtp_connection):
825825
self.smtp_connection = smtp_connection
826826
@@ -902,7 +902,7 @@ to show the setup/teardown flow::
902902
def test_1(modarg):
903903
print(" RUN test1 with modarg %s" % modarg)
904904
def test_2(otherarg, modarg):
905-
print(" RUN test2 with otherarg %s and modarg %s" % (otherarg, modarg))
905+
print(" RUN test2 with otherarg {} and modarg {}".format(otherarg, modarg))
906906
907907
908908
Let's run the tests in verbose mode and with looking at the print-output:
@@ -1001,7 +1001,7 @@ and declare its use in a test module via a ``usefixtures`` marker::
10011001
import pytest
10021002
10031003
@pytest.mark.usefixtures("cleandir")
1004-
class TestDirectoryInit(object):
1004+
class TestDirectoryInit:
10051005
def test_cwd_starts_empty(self):
10061006
assert os.listdir(os.getcwd()) == []
10071007
with open("myfile", "w") as f:
@@ -1086,7 +1086,7 @@ self-contained implementation of this idea::
10861086
10871087
import pytest
10881088
1089-
class DB(object):
1089+
class DB:
10901090
def __init__(self):
10911091
self.intransaction = []
10921092
def begin(self, name):
@@ -1098,7 +1098,7 @@ self-contained implementation of this idea::
10981098
def db():
10991099
return DB()
11001100
1101-
class TestClass(object):
1101+
class TestClass:
11021102
@pytest.fixture(autouse=True)
11031103
def transact(self, request, db):
11041104
db.begin(request.function.__name__)
@@ -1162,7 +1162,7 @@ and then e.g. have a TestClass using it by declaring the need::
11621162
.. code-block:: python
11631163
11641164
@pytest.mark.usefixtures("transact")
1165-
class TestClass(object):
1165+
class TestClass:
11661166
def test_method1(self):
11671167
...
11681168

doc/en/funcarg_compare.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ a per-session Database object::
2626
.. code-block:: python
2727
2828
# content of conftest.py
29-
class Database(object):
29+
class Database:
3030
def __init__(self):
3131
print("database instance created")
3232
def destroy(self):

doc/en/getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Once you develop multiple tests, you may want to group them into a class. pytest
114114
.. code-block:: python
115115
116116
# content of test_class.py
117-
class TestClass(object):
117+
class TestClass:
118118
def test_one(self):
119119
x = "this"
120120
assert 'h' in x

doc/en/unittest.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ it from a unittest-style test::
9393
9494
@pytest.fixture(scope="class")
9595
def db_class(request):
96-
class DummyDB(object):
96+
class DummyDB:
9797
pass
9898
# set a class attribute on the invoking test context
9999
request.cls.db = DummyDB()

doc/en/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ You can specify additional plugins to ``pytest.main``::
774774
775775
# content of myinvoke.py
776776
import pytest
777-
class MyPlugin(object):
777+
class MyPlugin:
778778
def pytest_sessionfinish(self):
779779
print("*** test run reporting finishing")
780780

0 commit comments

Comments
 (0)