Skip to content

Commit 63b2b52

Browse files
[E721] mix
1 parent 4a910ec commit 63b2b52

18 files changed

Lines changed: 48 additions & 48 deletions

src/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def message(self) -> str:
192192

193193
for f, lines in self._files or []:
194194
assert type(f) is str
195-
assert type(lines) in [str, bytes] # noqa: E721
195+
assert type(lines) in [str, bytes]
196196
msg.append(u'{}\n----\n{}\n'.format(f, lines))
197197

198198
return six.text_type('\n').join(msg)

src/impl/port_manager__generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def reserve_port(self) -> int:
4848
t = None
4949

5050
for port in sampled_ports:
51-
assert type(port) is int # noqa: E721
51+
assert type(port) is int
5252
assert port not in self._reserved_ports
5353
assert port in self._available_ports
5454

src/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ def _table_checksum__use_cn(
22442244

22452245
row = cursor.fetchone()
22462246
assert row is not None
2247-
assert type(row) in [list, tuple] # noqa: E721
2247+
assert type(row) in [list, tuple]
22482248
assert len(row) == 1
22492249
v = row[0]
22502250
sum += int(v if v is not None else 0)

tests/helpers/pg_node_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __str__(self) -> str:
5959

6060
def __repr__(self) -> str:
6161
# It must be overrided!
62-
assert type(self) == __class__ # noqa: E721
62+
assert type(self) is __class__
6363
r = "{}({}, {})".format(
6464
__class__.__name__,
6565
repr(self._data_dir),
@@ -100,7 +100,7 @@ def message(self) -> str:
100100

101101
for f, lines in self._files or []:
102102
assert type(f) is str
103-
assert type(lines) in [str, bytes] # noqa: E721
103+
assert type(lines) in [str, bytes]
104104
msg_parts.append(u'{}\n----\n{}\n'.format(f, lines))
105105

106106
return "\n".join(msg_parts)
@@ -157,7 +157,7 @@ def wait_for_running_state(
157157
timeout: T_WAIT_TIME,
158158
):
159159
assert type(node) is PostgresNode
160-
assert type(node_log_reader) == PostgresNodeLogReader # noqa: E721
160+
assert type(node_log_reader) is PostgresNodeLogReader
161161
assert type(timeout) in [int, float]
162162
assert node_log_reader._node is node
163163
assert timeout > 0
@@ -176,7 +176,7 @@ def wait_for_running_state(
176176
assert type(blocks) is list
177177

178178
for block in blocks:
179-
assert type(block) == PostgresNodeLogReader.LogDataBlock # noqa: E721
179+
assert type(block) is PostgresNodeLogReader.LogDataBlock
180180

181181
if 'Is another postmaster already running on port' in block.data:
182182
raise __class__.PortConflictNodeException(node.data_dir, node.port)

tests/test_os_ops_common.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_create_clone(self, os_ops: OsOperations):
6161
clone = os_ops.create_clone()
6262
assert clone is not None
6363
assert clone is not os_ops
64-
assert type(clone) == type(os_ops) # noqa: E721
64+
assert type(clone) is type(os_ops)
6565

6666
def test_exec_command_success(self, os_ops: OsOperations):
6767
"""
@@ -759,11 +759,11 @@ def __init__(self, sign, source, cp_rw, cp_truncate, cp_binary, cp_data, result)
759759
)
760760
def write_data001(self, request):
761761
assert isinstance(request, pytest.FixtureRequest)
762-
assert type(request.param) == __class__.tagWriteData001 # noqa: E721
762+
assert type(request.param) is __class__.tagWriteData001
763763
return request.param
764764

765765
def test_write(self, write_data001: tagWriteData001, os_ops: OsOperations):
766-
assert type(write_data001) == __class__.tagWriteData001 # noqa: E721
766+
assert type(write_data001) is __class__.tagWriteData001
767767
assert isinstance(os_ops, OsOperations)
768768

769769
mode = "w+b" if write_data001.call_param__binary else "w+"
@@ -847,7 +847,7 @@ def test_is_port_free__false(self, os_ops: OsOperations):
847847

848848
def LOCAL_server(s: socket.socket):
849849
assert s is not None
850-
assert type(s) == socket.socket # noqa: E721
850+
assert type(s) is socket.socket
851851

852852
try:
853853
while True:
@@ -873,7 +873,7 @@ def LOCAL_server(s: socket.socket):
873873

874874
s.listen(10)
875875

876-
assert type(th) == threading.Thread # noqa: E721
876+
assert type(th) is threading.Thread
877877
th.start()
878878

879879
try:
@@ -964,7 +964,7 @@ def data001(self, request: pytest.FixtureRequest) -> tagData_OS_OPS__NUMS:
964964
return request.param
965965

966966
def test_mkdir__mt(self, data001: tagData_OS_OPS__NUMS):
967-
assert type(data001) == __class__.tagData_OS_OPS__NUMS # noqa: E721
967+
assert type(data001) is __class__.tagData_OS_OPS__NUMS
968968

969969
N_WORKERS = 4
970970
N_NUMBERS = data001.nums
@@ -1261,7 +1261,7 @@ def test_kill(
12611261
)
12621262

12631263
assert proc is not None
1264-
assert type(proc) == subprocess.Popen # noqa: E721
1264+
assert type(proc) is subprocess.Popen
12651265
proc_pid = proc.pid
12661266
assert type(proc_pid) is int
12671267
logging.info("Test process pid is {}".format(proc_pid))
@@ -1332,7 +1332,7 @@ def test_kill__unk_pid(
13321332
)
13331333

13341334
assert proc is not None
1335-
assert type(proc) == subprocess.Popen # noqa: E721
1335+
assert type(proc) is subprocess.Popen
13361336
proc_pid = proc.pid
13371337
assert type(proc_pid) is int
13381338
logging.info("Test process pid is {}".format(proc_pid))
@@ -1387,10 +1387,10 @@ def test_kill__unk_pid(
13871387
logging.info("Our exception has type [{}]".format(type(x.value).__name__))
13881388

13891389
if type(os_ops).__name__ == "LocalOsOperations":
1390-
assert type(x.value) == ProcessLookupError # noqa: E721
1390+
assert type(x.value) is ProcessLookupError
13911391
assert "No such process" in str(x.value)
13921392
elif type(os_ops).__name__ == "RemoteOsOperations":
1393-
assert type(x.value) == ExecUtilException # noqa: E721
1393+
assert type(x.value) is ExecUtilException
13941394
assert "No such process" in str(x.value)
13951395
else:
13961396
RuntimeError("Unknown os_ops type: {}".format(type(os_ops).__name__))

tests/test_os_ops_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def test_rmdirs__try_to_delete_file(self, os_ops: OsOperations):
3232
os_ops.rmdirs(path, ignore_errors=False)
3333

3434
assert os.path.exists(path)
35-
assert type(x.value) == ExecUtilException # noqa: E721
36-
assert type(x.value.description) == str # noqa: E721
35+
assert type(x.value) is ExecUtilException
36+
assert type(x.value.description) is str
3737
assert x.value.description == "Utility exited with non-zero code (20). Error: `cannot remove '" + path + "': it is not a directory`"
3838
assert x.value.message.startswith(x.value.description)
3939
assert type(x.value.error) is str

tests/test_raise_error.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ def __init__(
1616
node_status: NodeStatus,
1717
expected_msg: str,
1818
):
19-
assert type(node_status) == NodeStatus # noqa: E721
19+
assert type(node_status) is NodeStatus
2020
assert type(expected_msg) is str
2121
self.node_status = node_status
2222
self.expected_msg = expected_msg
2323
return
2424

2525
@property
2626
def sign(self) -> str:
27-
assert type(self.node_status) == NodeStatus # noqa: E721
27+
assert type(self.node_status) is NodeStatus
2828

2929
msg = "status: {}".format(self.node_status)
3030
return msg
@@ -53,7 +53,7 @@ def test_001__node_err__cant_enumerate_child_processes(
5353
self,
5454
data001: tagTestData001,
5555
):
56-
assert type(data001) == __class__.tagTestData001 # noqa: E721
56+
assert type(data001) is __class__.tagTestData001
5757

5858
with pytest.raises(expected_exception=InvalidOperationException) as x:
5959
RaiseError.node_err__cant_enumerate_child_processes(
@@ -88,7 +88,7 @@ def test_002__node_err__cant_kill(
8888
self,
8989
data002: tagTestData001,
9090
):
91-
assert type(data002) == __class__.tagTestData001 # noqa: E721
91+
assert type(data002) is __class__.tagTestData001
9292

9393
with pytest.raises(expected_exception=InvalidOperationException) as x:
9494
RaiseError.node_err__cant_kill(

tests/test_testgres_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ def test_safe_psql__expect_error(self, node_svc: PostgresNodeService):
12321232
assert isinstance(node_svc, PostgresNodeService)
12331233
with __class__.helper__get_node(node_svc).init().start() as node:
12341234
err = node.safe_psql('select_or_not_select 1', expect_error=True)
1235-
assert (type(err) == str) # noqa: E721
1235+
assert (type(err) is str)
12361236
assert ('select_or_not_select' in err)
12371237
assert ('ERROR: syntax error at or near "select_or_not_select"' in err)
12381238

tests/test_testgres_local.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def test_port_rereserve_during_node_start(self):
273273
with get_new_node() as node1:
274274
node1.init().start()
275275
assert (node1._should_free_port)
276-
assert (type(node1.port) == int) # noqa: E721
276+
assert (type(node1.port) is int)
277277
node1_port_copy = node1.port
278278
assert (rm_carriage_returns(node1.safe_psql("SELECT 1;")) == b'1\n')
279279

@@ -306,7 +306,7 @@ def test_port_conflict(self):
306306
with get_new_node() as node1:
307307
node1.init().start()
308308
assert (node1._should_free_port)
309-
assert (type(node1.port) == int) # noqa: E721
309+
assert (type(node1.port) is int)
310310
node1_port_copy = node1.port
311311
assert (rm_carriage_returns(node1.safe_psql("SELECT 1;")) == b'1\n')
312312

tests/units/exceptions/BackupException/test_set001__constructor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class TestSet001_Constructor:
66
def test_001__default(self):
77
e = BackupException()
8-
assert type(e) == BackupException # noqa: E721
8+
assert type(e) is BackupException
99
assert isinstance(e, testgres__TestgresException)
1010
assert e.source is None
1111
assert e.message == ""
@@ -15,7 +15,7 @@ def test_001__default(self):
1515

1616
def test_002__message(self):
1717
e = BackupException(message="abc\n123")
18-
assert type(e) == BackupException # noqa: E721
18+
assert type(e) is BackupException
1919
assert isinstance(e, testgres__TestgresException)
2020
assert e.source is None
2121
assert e.message == "abc\n123"

0 commit comments

Comments
 (0)