Skip to content

Commit c4aff64

Browse files
authored
Fixing spelling and minor whitespace issues in tests (#1225)
1 parent 1798cf7 commit c4aff64

29 files changed

+86
-84
lines changed

tests/integration/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def drop_keyspace_shutdown_cluster(keyspace_name, session, cluster):
699699
try:
700700
execute_with_long_wait_retry(session, "DROP KEYSPACE {0}".format(keyspace_name))
701701
except:
702-
log.warning("Error encountered when droping keyspace {0}".format(keyspace_name))
702+
log.warning("Error encountered when dropping keyspace {0}".format(keyspace_name))
703703
ex_type, ex, tb = sys.exc_info()
704704
log.warning("{0}: {1} Backtrace: {2}".format(ex_type.__name__, ex, traceback.extract_tb(tb)))
705705
del tb

tests/integration/advanced/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def use_singledc_wth_graph_and_spark(start=True):
8888

8989
def use_cluster_with_graph(num_nodes):
9090
"""
91-
This is a work around to account for the fact that spark nodes will conflict over master assignment
91+
This is a workaround to account for the fact that spark nodes will conflict over master assignment
9292
when started all at once.
9393
"""
9494
if USE_CASS_EXTERNAL:
@@ -125,7 +125,7 @@ def use_cluster_with_graph(num_nodes):
125125

126126
class BasicGeometricUnitTestCase(BasicKeyspaceUnitTestCase):
127127
"""
128-
This base test class is used by all the geomteric tests. It contains class level teardown and setup
128+
This base test class is used by all the geometric tests. It contains class level teardown and setup
129129
methods. It also contains the test fixtures used by those tests
130130
"""
131131

tests/integration/advanced/graph/test_graph_query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def _test_range_query(self, schema, graphson):
244244
"""
245245
Test to validate range queries are handled correctly.
246246
247-
Creates a very large line graph script and executes it. Then proceeds to to a range
247+
Creates a very large line graph script and executes it. Then proceeds to a range
248248
limited query against it, and ensure that the results are formatted correctly and that
249249
the result set is properly sized.
250250
@@ -331,7 +331,7 @@ def _test_large_create_script(self, schema, graphson):
331331
@test_category dse graph
332332
"""
333333
self.execute_graph(schema.fixtures.line(150), graphson)
334-
self.execute_graph(schema.fixtures.line(300), graphson) # This should passed since the queries are splitted
334+
self.execute_graph(schema.fixtures.line(300), graphson) # This should pass since the queries are split
335335
self.assertRaises(SyntaxException, self.execute_graph, schema.fixtures.line(300, single_script=True), graphson) # this is not and too big
336336

337337
def _test_large_result_set(self, schema, graphson):

tests/integration/advanced/test_auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class BasicDseAuthTest(unittest.TestCase):
6767
@classmethod
6868
def setUpClass(self):
6969
"""
70-
This will setup the necessary infrastructure to run our authentication tests. It requres the ADS_HOME environment variable
70+
This will setup the necessary infrastructure to run our authentication tests. It requires the ADS_HOME environment variable
7171
and our custom embedded apache directory server jar in order to run.
7272
"""
7373
if not DSE_VERSION:
@@ -86,7 +86,7 @@ def setUpClass(self):
8686
self.charlie_keytab = os.path.join(self.conf_file_dir, "charlie.keytab")
8787
actual_jar = os.path.join(ADS_HOME, "embedded-ads.jar")
8888

89-
# Create configuration directories if they don't already exists
89+
# Create configuration directories if they don't already exist
9090
if not os.path.exists(self.conf_file_dir):
9191
os.makedirs(self.conf_file_dir)
9292
if not os.path.exists(actual_jar):
@@ -175,7 +175,7 @@ def test_should_not_authenticate_with_bad_user_ticket(self):
175175
auth_provider = DSEGSSAPIAuthProvider(service='dse', qops=["auth"])
176176
self.assertRaises(NoHostAvailable, self.connect_and_query, auth_provider)
177177

178-
def test_should_not_athenticate_without_ticket(self):
178+
def test_should_not_authenticate_without_ticket(self):
179179
"""
180180
This tests will attempt to authenticate with a user that is valid but has no ticket
181181
@since 3.20

tests/integration/advanced/test_cont_paging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def create_cluster(cls):
7070

7171
cls.select_all_statement = "SELECT * FROM {0}.{0}".format(cls.ks_name)
7272

73-
def test_continous_paging(self):
73+
def test_continuous_paging(self):
7474
"""
7575
Test to ensure that various continuous paging schemes return the full set of results.
7676
@since 3.20
7777
@jira_ticket PYTHON-615
78-
@expected_result various continous paging options should fetch all the results
78+
@expected_result various continuous paging options should fetch all the results
7979
8080
@test_category queries
8181
"""
@@ -131,9 +131,9 @@ def test_paging_cancel(self):
131131
self.session_with_profiles.default_fetch_size = 1
132132
# This combination should fetch one result a second. We should see a very few results
133133
results = self.session_with_profiles.execute_async(self.select_all_statement, execution_profile= "SLOW")
134-
result_set =results.result()
134+
result_set = results.result()
135135
result_set.cancel_continuous_paging()
136-
result_lst =list(result_set)
136+
result_lst = list(result_set)
137137
self.assertLess(len(result_lst), 2, "Cancel should have aborted fetch immediately")
138138

139139
def test_con_paging_verify_writes(self):
@@ -183,7 +183,7 @@ def test_con_paging_verify_writes(self):
183183

184184
def test_can_get_results_when_no_more_pages(self):
185185
"""
186-
Test to validate that the resutls can be fetched when
186+
Test to validate that the results can be fetched when
187187
has_more_pages is False
188188
@since 3.20
189189
@jira_ticket PYTHON-946

tests/integration/advanced/test_geometry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AbstractGeometricTypeTest():
3535

3636
def test_should_insert_simple(self):
3737
"""
38-
This tests will attempt to insert a point, polygon, or line, using simple inline formating.
38+
This tests will attempt to insert a point, polygon, or line, using simple inline formatting.
3939
@since 3.20
4040
@jira_ticket PYTHON-456
4141
@test_category dse geometric

tests/integration/advanced/test_spark.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def setup_module():
3030
@requiredse
3131
class SparkLBTests(BasicGraphUnitTestCase):
3232
"""
33-
Test to validate that analtics query can run in a multi-node enviroment. Also check to to ensure
33+
Test to validate that analytics query can run in a multi-node environment. Also check to ensure
3434
that the master spark node is correctly targeted when OLAP queries are run
3535
3636
@since 3.20
@@ -42,7 +42,7 @@ def test_spark_analytic_query(self):
4242
self.session.execute_graph(ClassicGraphFixtures.classic())
4343
spark_master = find_spark_master(self.session)
4444

45-
# Run multipltle times to ensure we don't round robin
45+
# Run multiple times to ensure we don't round-robin
4646
for i in range(3):
4747
to_run = SimpleGraphStatement("g.V().count()")
4848
rs = self.session.execute_graph(to_run, execution_profile=EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT)

tests/integration/cloud/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
from tests.integration.cloud import setup_package, teardown_package
44

5+
56
@pytest.fixture(scope='session', autouse=True)
67
def setup_and_teardown_packages():
78
setup_package()
89
yield
9-
teardown_package()
10+
teardown_package()

tests/integration/cloud/test_cloud_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def test_for_schema_disagreement_attribute(self):
110110
self.check_and_wait_for_agreement(session, rs, True)
111111
cluster.shutdown()
112112

113-
def check_and_wait_for_agreement(self, session, rs, exepected):
113+
def check_and_wait_for_agreement(self, session, rs, expected):
114114
# Wait for RESULT_KIND_SCHEMA_CHANGE message to arrive
115115
time.sleep(1)
116-
self.assertEqual(rs.response_future.is_schema_agreed, exepected)
116+
self.assertEqual(rs.response_future.is_schema_agreed, expected)
117117
if not rs.response_future.is_schema_agreed:
118118
session.cluster.control_connection.wait_for_schema_agreement(wait_time=1000)

tests/integration/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
from tests.integration import teardown_package
44

5+
56
@pytest.fixture(scope='session', autouse=True)
67
def setup_and_teardown_packages():
78
print('setup')
89
yield
9-
teardown_package()
10+
teardown_package()

tests/integration/cqlengine/test_connections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_context_connection_priority(self):
7979
"""
8080
Tests to ensure the proper connection priority is honored.
8181
82-
Explicit connection should have higest priority,
82+
Explicit connection should have the highest priority,
8383
Followed by context query connection
8484
Default connection should be honored last.
8585
@@ -458,7 +458,7 @@ def test_keyspace(self):
458458
459459
@since 3.7
460460
@jira_ticket PYTHON-613
461-
@expected_result Keyspace segration is honored
461+
@expected_result Keyspace segregation is honored
462462
463463
@test_category object_mapper
464464
"""

tests/integration/cqlengine/test_ifexists.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_update_if_exists(self):
100100
m = TestIfExistsModel.get(id=id)
101101
self.assertEqual(m.text, 'changed_again')
102102

103-
m = TestIfExistsModel(id=uuid4(), count=44) # do not exists
103+
m = TestIfExistsModel(id=uuid4(), count=44) # do not exist
104104
with self.assertRaises(LWTException) as assertion:
105105
m.if_exists().update()
106106

@@ -155,7 +155,7 @@ def test_batch_update_if_exists_success(self):
155155
@unittest.skipUnless(PROTOCOL_VERSION >= 2, "only runs against the cql3 protocol v2.0")
156156
def test_batch_mixed_update_if_exists_success(self):
157157
"""
158-
Tests that batch update with with one bad query will still fail with LWTException
158+
Tests that batch update with one bad query will still fail with LWTException
159159
160160
@since 3.1
161161
@jira_ticket PYTHON-432
@@ -177,7 +177,7 @@ def test_batch_mixed_update_if_exists_success(self):
177177
@unittest.skipUnless(PROTOCOL_VERSION >= 2, "only runs against the cql3 protocol v2.0")
178178
def test_delete_if_exists(self):
179179
"""
180-
Tests that delete with if_exists work, and throw proper LWT exception when they are are not applied
180+
Tests that delete with if_exists work, and throws proper LWT exception when they are not applied
181181
182182
@since 3.1
183183
@jira_ticket PYTHON-432
@@ -193,7 +193,7 @@ def test_delete_if_exists(self):
193193
q = TestIfExistsModel.objects(id=id)
194194
self.assertEqual(len(q), 0)
195195

196-
m = TestIfExistsModel(id=uuid4(), count=44) # do not exists
196+
m = TestIfExistsModel(id=uuid4(), count=44) # do not exist
197197
with self.assertRaises(LWTException) as assertion:
198198
m.if_exists().delete()
199199

@@ -212,7 +212,7 @@ def test_delete_if_exists(self):
212212
@unittest.skipUnless(PROTOCOL_VERSION >= 2, "only runs against the cql3 protocol v2.0")
213213
def test_batch_delete_if_exists_success(self):
214214
"""
215-
Tests that batch deletes with if_exists work, and throw proper LWTException when they are are not applied
215+
Tests that batch deletes with if_exists work, and throws proper LWTException when they are not applied
216216
217217
@since 3.1
218218
@jira_ticket PYTHON-432
@@ -243,7 +243,7 @@ def test_batch_delete_if_exists_success(self):
243243
@unittest.skipUnless(PROTOCOL_VERSION >= 2, "only runs against the cql3 protocol v2.0")
244244
def test_batch_delete_mixed(self):
245245
"""
246-
Tests that batch deletes with multiple queries and throw proper LWTException when they are are not all applicable
246+
Tests that batch deletes with multiple queries and throws proper LWTException when they are not all applicable
247247
248248
@since 3.1
249249
@jira_ticket PYTHON-432
@@ -309,4 +309,3 @@ def test_instance_raise_exception(self):
309309
id = uuid4()
310310
with self.assertRaises(IfExistsWithCounterColumn):
311311
TestIfExistsWithCounterModel.if_exists()
312-

tests/integration/cqlengine/test_ifnotexists.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,3 @@ def test_instance_raise_exception(self):
198198
id = uuid4()
199199
with self.assertRaises(IfNotExistsWithCounterColumn):
200200
TestIfNotExistsWithCounterModel.if_not_exists()
201-

tests/integration/cqlengine/test_lwt_conditional.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ def test_batch_update_conditional_several_rows(self):
158158
second_row.delete()
159159
b.execute()
160160

161-
162161
def test_delete_conditional(self):
163162
# DML path
164163
t = TestConditionalModel.if_not_exists().create(text='something', count=5)

tests/integration/cqlengine/test_timestamp.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ def test_delete_in_the_past(self):
199199

200200
TestTimestampModel.get(id=uid).should.be.ok
201201

202-
# delete the in past, should not affect the object created above
202+
# delete in the past, should not affect the object created above
203203
TestTimestampModel.objects(id=uid).timestamp(timedelta(seconds=-60)).delete()
204204

205205
TestTimestampModel.get(id=uid)
206-
207-

tests/integration/cqlengine/test_ttl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_default_ttl_not_set(self):
179179
self.assertEqual(default_ttl, 0)
180180

181181
with mock.patch.object(session, 'execute') as m:
182-
TestTTLModel.objects(id=tid).update(text="aligators")
182+
TestTTLModel.objects(id=tid).update(text="alligators")
183183

184184
query = m.call_args[0][0].query_string
185185
self.assertNotIn("USING TTL", query)
@@ -197,7 +197,7 @@ def test_default_ttl_set(self):
197197
self.assertEqual(default_ttl, 20)
198198

199199
with mock.patch.object(session, 'execute') as m:
200-
TestTTLModel.objects(id=tid).update(text="aligators expired")
200+
TestTTLModel.objects(id=tid).update(text="alligators expired")
201201

202202
# Should not be set either
203203
query = m.call_args[0][0].query_string
@@ -228,7 +228,7 @@ def test_override_default_ttl(self):
228228
self.assertEqual(o._ttl, 3600)
229229

230230
with mock.patch.object(session, 'execute') as m:
231-
TestDefaultTTLModel.objects(id=tid).ttl(None).update(text="aligators expired")
231+
TestDefaultTTLModel.objects(id=tid).ttl(None).update(text="alligators expired")
232232

233233
query = m.call_args[0][0].query_string
234234
self.assertNotIn("USING TTL", query)

tests/integration/standard/column_encryption/test_policies.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
from cassandra.column_encryption.policies import AES256ColumnEncryptionPolicy, \
2323
AES256_KEY_SIZE_BYTES, AES256_BLOCK_SIZE_BYTES
2424

25+
2526
def setup_module():
2627
use_singledc()
2728

29+
2830
class ColumnEncryptionPolicyTest(unittest.TestCase):
2931

3032
def _recreate_keyspace(self, session):
@@ -57,13 +59,13 @@ def test_end_to_end_prepared(self):
5759

5860
# A straight select from the database will now return the decrypted bits. We select both encrypted and unencrypted
5961
# values here to confirm that we don't interfere with regular processing of unencrypted vals.
60-
(encrypted,unencrypted) = session.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
62+
(encrypted, unencrypted) = session.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
6163
self.assertEqual(expected, encrypted)
6264
self.assertEqual(expected, unencrypted)
6365

6466
# Confirm the same behaviour from a subsequent prepared statement as well
6567
prepared = session.prepare("select encrypted, unencrypted from foo.bar where unencrypted = ? allow filtering")
66-
(encrypted,unencrypted) = session.execute(prepared, [expected]).one()
68+
(encrypted, unencrypted) = session.execute(prepared, [expected]).one()
6769
self.assertEqual(expected, encrypted)
6870
self.assertEqual(expected, unencrypted)
6971

@@ -78,20 +80,20 @@ def test_end_to_end_simple(self):
7880
self._recreate_keyspace(session)
7981

8082
# Use encode_and_encrypt helper function to populate date
81-
for i in range(1,100):
83+
for i in range(1, 100):
8284
self.assertIsNotNone(i)
8385
encrypted = cl_policy.encode_and_encrypt(col_desc, i)
8486
session.execute("insert into foo.bar (encrypted, unencrypted) values (%s,%s)", (encrypted, i))
8587

8688
# A straight select from the database will now return the decrypted bits. We select both encrypted and unencrypted
8789
# values here to confirm that we don't interfere with regular processing of unencrypted vals.
88-
(encrypted,unencrypted) = session.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
90+
(encrypted, unencrypted) = session.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
8991
self.assertEqual(expected, encrypted)
9092
self.assertEqual(expected, unencrypted)
9193

9294
# Confirm the same behaviour from a subsequent prepared statement as well
9395
prepared = session.prepare("select encrypted, unencrypted from foo.bar where unencrypted = ? allow filtering")
94-
(encrypted,unencrypted) = session.execute(prepared, [expected]).one()
96+
(encrypted, unencrypted) = session.execute(prepared, [expected]).one()
9597
self.assertEqual(expected, encrypted)
9698
self.assertEqual(expected, unencrypted)
9799

@@ -117,7 +119,7 @@ def test_end_to_end_different_cle_contexts_different_ivs(self):
117119
self._recreate_keyspace(session1)
118120

119121
# Use encode_and_encrypt helper function to populate date
120-
for i in range(1,100):
122+
for i in range(1, 100):
121123
self.assertIsNotNone(i)
122124
encrypted = cl_policy1.encode_and_encrypt(col_desc1, i)
123125
session1.execute("insert into foo.bar (encrypted, unencrypted) values (%s,%s)", (encrypted, i))
@@ -134,7 +136,7 @@ def test_end_to_end_different_cle_contexts_different_ivs(self):
134136
(_, cl_policy2) = self._create_policy(key, iv=iv2)
135137
cluster2 = TestCluster(column_encryption_policy=cl_policy2)
136138
session2 = cluster2.connect()
137-
(encrypted,unencrypted) = session2.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
139+
(encrypted, unencrypted) = session2.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
138140
self.assertEqual(expected, encrypted)
139141
self.assertEqual(expected, unencrypted)
140142

@@ -152,19 +154,19 @@ def test_end_to_end_different_cle_contexts_different_policies(self):
152154
self._recreate_keyspace(session)
153155

154156
# Use encode_and_encrypt helper function to populate date
155-
session.execute("insert into foo.bar (encrypted, unencrypted) values (%s,%s)",(cl_policy.encode_and_encrypt(col_desc, expected), expected))
157+
session.execute("insert into foo.bar (encrypted, unencrypted) values (%s,%s)", (cl_policy.encode_and_encrypt(col_desc, expected), expected))
156158

157159
# We now open a new session _without_ the CLE policy specified. We should _not_ be able to read decrypted bits from this session.
158160
cluster2 = TestCluster()
159161
session2 = cluster2.connect()
160162

161163
# A straight select from the database will now return the decrypted bits. We select both encrypted and unencrypted
162164
# values here to confirm that we don't interfere with regular processing of unencrypted vals.
163-
(encrypted,unencrypted) = session2.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
165+
(encrypted, unencrypted) = session2.execute("select encrypted, unencrypted from foo.bar where unencrypted = %s allow filtering", (expected,)).one()
164166
self.assertEqual(cl_policy.encode_and_encrypt(col_desc, expected), encrypted)
165167
self.assertEqual(expected, unencrypted)
166168

167169
# Confirm the same behaviour from a subsequent prepared statement as well
168170
prepared = session2.prepare("select encrypted, unencrypted from foo.bar where unencrypted = ? allow filtering")
169-
(encrypted,unencrypted) = session2.execute(prepared, [expected]).one()
171+
(encrypted, unencrypted) = session2.execute(prepared, [expected]).one()
170172
self.assertEqual(cl_policy.encode_and_encrypt(col_desc, expected), encrypted)

0 commit comments

Comments
 (0)