Skip to content

Commit a246925

Browse files
committed
Remove is <int>
It does not match orthodox python style. And trigger warnings: cqlengine/query/test_queryoperators.py:157: SyntaxWarning: "is" with 'int' literal. Did you mean "=="? self.assertTrue(len(first_page) is 1)
1 parent d62eb38 commit a246925

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

tests/integration/cqlengine/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ def wrapped_function(*args, **kwargs):
7777
# DeMonkey Patch our code
7878
cassandra.cqlengine.connection.execute = original_function
7979
# Check to see if we have a pre-existing test case to work from.
80-
if len(args) is 0:
81-
test_case = unittest.TestCase("__init__")
82-
else:
80+
if args:
8381
test_case = args[0]
82+
else:
83+
test_case = unittest.TestCase("__init__")
8484
# Check to see if the count is what you expect
8585
test_case.assertEqual(count.get_counter(), expected, msg="Expected number of cassandra.cqlengine.connection.execute calls ({0}) doesn't match actual number invoked ({1})".format(expected, count.get_counter()))
8686
return to_return

tests/integration/cqlengine/query/test_queryoperators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,6 @@ def test_named_table_pk_token_function(self):
154154
query = named.all().limit(1)
155155
first_page = list(query)
156156
last = first_page[-1]
157-
self.assertTrue(len(first_page) is 1)
157+
self.assertTrue(len(first_page) == 1)
158158
next_page = list(query.filter(pk__token__gt=functions.Token(last.key)))
159-
self.assertTrue(len(next_page) is 1)
159+
self.assertTrue(len(next_page) == 1)

tests/integration/standard/test_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def wait_for_connections(self, host, cluster):
182182
while(retry < 300):
183183
retry += 1
184184
connections = self.fetch_connections(host, cluster)
185-
if len(connections) is not 0:
185+
if connections:
186186
return connections
187187
time.sleep(.1)
188188
self.fail("No new connections found")
@@ -192,7 +192,7 @@ def wait_for_no_connections(self, host, cluster):
192192
while(retry < 100):
193193
retry += 1
194194
connections = self.fetch_connections(host, cluster)
195-
if len(connections) is 0:
195+
if not connections:
196196
return
197197
time.sleep(.5)
198198
self.fail("Connections never cleared")

0 commit comments

Comments
 (0)