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

Skip to content

Commit 1cb664e

Browse files
Using pytest [assertFalse]
1 parent 12d702a commit 1cb664e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

tests/test_simple.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_custom_init(self):
131131
self.assertGreaterEqual(len(lines), 6)
132132

133133
# there should be no trust entries at all
134-
self.assertFalse(any('trust' in s for s in lines))
134+
assert not (any('trust' in s for s in lines))
135135

136136
def test_double_init(self):
137137
with get_new_node().init() as node:
@@ -190,7 +190,7 @@ def test_node_exit(self):
190190
base_dir = node.base_dir
191191

192192
# should have been removed by default
193-
self.assertFalse(os.path.exists(base_dir))
193+
assert not (os.path.exists(base_dir))
194194

195195
def test_double_start(self):
196196
with get_new_node().init().start() as node:
@@ -245,8 +245,8 @@ def test_pg_ctl(self):
245245

246246
def test_status(self):
247247
self.assertTrue(NodeStatus.Running)
248-
self.assertFalse(NodeStatus.Stopped)
249-
self.assertFalse(NodeStatus.Uninitialized)
248+
assert not (NodeStatus.Stopped)
249+
assert not (NodeStatus.Uninitialized)
250250

251251
# check statuses after each operation
252252
with get_new_node() as node:
@@ -812,7 +812,7 @@ def test_pg_config(self):
812812
# modify setting for this scope
813813
with scoped_config(cache_pg_config=False) as config:
814814
# sanity check for value
815-
self.assertFalse(config.cache_pg_config)
815+
assert not (config.cache_pg_config)
816816

817817
# save right after config change
818818
c2 = get_pg_config()
@@ -1077,7 +1077,7 @@ def test_the_same_port(self):
10771077
with get_new_node(port=node.port) as node2:
10781078
self.assertEqual(type(node2.port), int)
10791079
self.assertEqual(node2.port, node.port)
1080-
self.assertFalse(node2._should_free_port)
1080+
assert not (node2._should_free_port)
10811081

10821082
with pytest.raises(
10831083
expected_exception=StartNodeException,
@@ -1247,7 +1247,7 @@ def test_port_conflict(self):
12471247
self.assertTrue(node2._should_free_port)
12481248
self.assertEqual(__class__.tagPortManagerProxy.sm_DummyPortCurrentUsage, 1)
12491249
self.assertEqual(__class__.tagPortManagerProxy.sm_DummyPortTotalUsage, C_COUNT_OF_BAD_PORT_USAGE)
1250-
self.assertFalse(node2.is_started)
1250+
assert not (node2.is_started)
12511251

12521252
# node2 must release our dummyPort (node1.port)
12531253
self.assertEqual(__class__.tagPortManagerProxy.sm_DummyPortCurrentUsage, 0)

tests/test_simple_remote.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_custom_init(self):
118118
self.assertGreaterEqual(len(lines), 6)
119119

120120
# there should be no trust entries at all
121-
self.assertFalse(any('trust' in s for s in lines))
121+
assert not (any('trust' in s for s in lines))
122122

123123
def test_init__LANG_С(self):
124124
# PBCKP-1744
@@ -247,7 +247,7 @@ def test_node_exit(self):
247247
base_dir = node.base_dir
248248

249249
# should have been removed by default
250-
self.assertFalse(os_ops.path_exists(base_dir))
250+
assert not (os_ops.path_exists(base_dir))
251251

252252
def test_double_start(self):
253253
with get_remote_node(conn_params=conn_params).init().start() as node:
@@ -302,8 +302,8 @@ def test_pg_ctl(self):
302302

303303
def test_status(self):
304304
self.assertTrue(NodeStatus.Running)
305-
self.assertFalse(NodeStatus.Stopped)
306-
self.assertFalse(NodeStatus.Uninitialized)
305+
assert not (NodeStatus.Stopped)
306+
assert not (NodeStatus.Uninitialized)
307307

308308
# check statuses after each operation
309309
with get_remote_node(conn_params=conn_params) as node:
@@ -859,7 +859,7 @@ def test_pg_config(self):
859859
# modify setting for this scope
860860
with scoped_config(cache_pg_config=False) as config:
861861
# sanity check for value
862-
self.assertFalse(config.cache_pg_config)
862+
assert not (config.cache_pg_config)
863863

864864
# save right after config change
865865
c2 = get_pg_config()

0 commit comments

Comments
 (0)