Skip to content

Commit

Permalink
Remove is <int>
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
dkropachev committed Jan 4, 2025
1 parent d62eb38 commit a246925
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/integration/cqlengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def wrapped_function(*args, **kwargs):
# DeMonkey Patch our code
cassandra.cqlengine.connection.execute = original_function
# Check to see if we have a pre-existing test case to work from.
if len(args) is 0:
test_case = unittest.TestCase("__init__")
else:
if args:
test_case = args[0]
else:
test_case = unittest.TestCase("__init__")
# Check to see if the count is what you expect
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()))
return to_return
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cqlengine/query/test_queryoperators.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ def test_named_table_pk_token_function(self):
query = named.all().limit(1)
first_page = list(query)
last = first_page[-1]
self.assertTrue(len(first_page) is 1)
self.assertTrue(len(first_page) == 1)
next_page = list(query.filter(pk__token__gt=functions.Token(last.key)))
self.assertTrue(len(next_page) is 1)
self.assertTrue(len(next_page) == 1)
4 changes: 2 additions & 2 deletions tests/integration/standard/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def wait_for_connections(self, host, cluster):
while(retry < 300):
retry += 1
connections = self.fetch_connections(host, cluster)
if len(connections) is not 0:
if connections:
return connections
time.sleep(.1)
self.fail("No new connections found")
Expand All @@ -192,7 +192,7 @@ def wait_for_no_connections(self, host, cluster):
while(retry < 100):
retry += 1
connections = self.fetch_connections(host, cluster)
if len(connections) is 0:
if not connections:
return
time.sleep(.5)
self.fail("Connections never cleared")
Expand Down

0 comments on commit a246925

Please sign in to comment.