Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a82cf3d

Browse files
Code style (flake8)
1 parent df199b9 commit a82cf3d

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

tests/test_simple.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,11 @@ def test_synchronous_replication(self):
475475

476476
# check formatting
477477
assert (
478-
'1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
479-
str(First(1, (standby1, standby2)))) # yapf: disable
478+
'1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(First(1, (standby1, standby2)))
479+
) # yapf: disable
480480
assert (
481-
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
482-
str(Any(1, (standby1, standby2)))) # yapf: disable
481+
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(Any(1, (standby1, standby2)))
482+
) # yapf: disable
483483

484484
# set synchronous_standby_names
485485
master.set_synchronous_standbys(First(2, [standby1, standby2]))
@@ -592,7 +592,7 @@ def test_logical_catchup(self):
592592
node1.execute('insert into test values ({0}, {0})'.format(i))
593593
sub.catchup()
594594
res = node2.execute('select * from test')
595-
assert (res == [(i,i,)])
595+
assert (res == [(i, i, )])
596596
node1.execute('delete from test')
597597

598598
# @unittest.skipIf(pg_version_ge('10'), 'requires <10')
@@ -1030,7 +1030,7 @@ def test_child_process_dies(self):
10301030
cmd = ["timeout", "60"] if os.name == 'nt' else ["sleep", "60"]
10311031

10321032
with subprocess.Popen(cmd, shell=True) as process: # shell=True might be needed on Windows
1033-
assert (process.poll() == None)
1033+
assert (process.poll() is None)
10341034
# collect list of processes currently running
10351035
children = psutil.Process(os.getpid()).children()
10361036
# kill a process, so received children dictionary becomes invalid
@@ -1066,12 +1066,12 @@ def test_the_same_port(self):
10661066
with get_new_node() as node:
10671067
node.init().start()
10681068
assert (node._should_free_port)
1069-
assert (type(node.port) == int)
1069+
assert (type(node.port) == int) # noqa: E721
10701070
node_port_copy = node.port
10711071
assert (rm_carriage_returns(node.safe_psql("SELECT 1;")) == b'1\n')
10721072

10731073
with get_new_node(port=node.port) as node2:
1074-
assert (type(node2.port) == int)
1074+
assert (type(node2.port) == int) # noqa: E721
10751075
assert (node2.port == node.port)
10761076
assert not (node2._should_free_port)
10771077

@@ -1317,6 +1317,7 @@ def test_set_auto_conf(self):
13171317

13181318
for x in testData:
13191319
assert x[0] + " = " + x[2] in content
1320+
13201321
@staticmethod
13211322
def helper__skip_test_if_util_not_exist(name: str):
13221323
assert type(name) == str # noqa: E721
@@ -1340,4 +1341,3 @@ def helper__skip_test_if_pg_version_is_ge(version: str):
13401341
assert type(version) == str # noqa: E721
13411342
if pg_version_ge(version):
13421343
pytest.skip('requires <{0}'.format(version))
1343-

tests/test_simple_remote.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,11 @@ def test_synchronous_replication(self):
528528

529529
# check formatting
530530
assert (
531-
'1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
532-
str(First(1, (standby1, standby2)))) # yapf: disable
531+
'1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(First(1, (standby1, standby2)))
532+
) # yapf: disable
533533
assert (
534-
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
535-
str(Any(1, (standby1, standby2)))) # yapf: disable
534+
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(Any(1, (standby1, standby2)))
535+
) # yapf: disable
536536

537537
# set synchronous_standby_names
538538
master.set_synchronous_standbys(First(2, [standby1, standby2]))
@@ -645,7 +645,7 @@ def test_logical_catchup(self):
645645
node1.execute('insert into test values ({0}, {0})'.format(i))
646646
sub.catchup()
647647
res = node2.execute('select * from test')
648-
assert (res == [(i,i,)])
648+
assert (res == [(i, i, )])
649649
node1.execute('delete from test')
650650

651651
# @unittest.skipIf(pg_version_ge('10'), 'requires <10')
@@ -1071,7 +1071,7 @@ def test_child_pids(self):
10711071
def test_child_process_dies(self):
10721072
# test for FileNotFound exception during child_processes() function
10731073
with subprocess.Popen(["sleep", "60"]) as process:
1074-
assert (process.poll() == None)
1074+
assert (process.poll() is None)
10751075
# collect list of processes currently running
10761076
children = psutil.Process(os.getpid()).children()
10771077
# kill a process, so received children dictionary becomes invalid
@@ -1104,4 +1104,3 @@ def helper__skip_test_if_pg_version_is_ge(version: str):
11041104
assert type(version) == str # noqa: E721
11051105
if pg_version_ge(version):
11061106
pytest.skip('requires <{0}'.format(version))
1107-

0 commit comments

Comments
 (0)