Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4afbe00

Browse files
Using pytest [assertIn]
1 parenteaaa276 commit4afbe00

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

‎tests/test_simple.py‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ def test_safe_psql__expect_error(self):
321321
withget_new_node().init().start()asnode:
322322
err=node.safe_psql('select_or_not_select 1',expect_error=True)
323323
assert (type(err)==str)# noqa: E721
324-
self.assertIn('select_or_not_select',err)
325-
self.assertIn('ERROR: syntax error at or near "select_or_not_select"',err)
324+
assert('select_or_not_select'inerr)
325+
assert('ERROR: syntax error at or near "select_or_not_select"'inerr)
326326

327327
# ---------
328328
withpytest.raises(
@@ -1011,11 +1011,11 @@ def test_child_pids(self):
10111011

10121012
master_pids=master.auxiliary_pids
10131013
forptypeinmaster_processes:
1014-
self.assertIn(ptype,master_pids)
1014+
assert(ptypeinmaster_pids)
10151015

10161016
replica_pids=replica.auxiliary_pids
10171017
forptypeinrepl_processes:
1018-
self.assertIn(ptype,replica_pids)
1018+
assert(ptypeinreplica_pids)
10191019

10201020
# there should be exactly 1 source walsender for replica
10211021
assert (len(master_pids[ProcessType.WalSender])==1)
@@ -1320,12 +1320,7 @@ def test_set_auto_conf(self):
13201320
content=f.read()
13211321

13221322
forxintestData:
1323-
self.assertIn(
1324-
x[0]+" = "+x[2],
1325-
content,
1326-
x[0]+" stored wrong"
1327-
)
1328-
1323+
assertx[0]+" = "+x[2]incontent
13291324
@staticmethod
13301325
defhelper__skip_test_if_util_not_exist(name:str):
13311326
asserttype(name)==str# noqa: E721

‎tests/test_simple_remote.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ def test_safe_psql__expect_error(self):
377377
withget_remote_node(conn_params=conn_params).init().start()asnode:
378378
err=node.safe_psql('select_or_not_select 1',expect_error=True)
379379
assert (type(err)==str)# noqa: E721
380-
self.assertIn('select_or_not_select',err)
381-
self.assertIn('ERROR: syntax error at or near "select_or_not_select"',err)
380+
assert('select_or_not_select'inerr)
381+
assert('ERROR: syntax error at or near "select_or_not_select"'inerr)
382382

383383
# ---------
384384
withpytest.raises(
@@ -1054,11 +1054,11 @@ def test_child_pids(self):
10541054

10551055
master_pids=master.auxiliary_pids
10561056
forptypeinmaster_processes:
1057-
self.assertIn(ptype,master_pids)
1057+
assert(ptypeinmaster_pids)
10581058

10591059
replica_pids=replica.auxiliary_pids
10601060
forptypeinrepl_processes:
1061-
self.assertIn(ptype,replica_pids)
1061+
assert(ptypeinreplica_pids)
10621062

10631063
# there should be exactly 1 source walsender for replica
10641064
assert (len(master_pids[ProcessType.WalSender])==1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp