Skip to content

Commit

Permalink
Add type annotations and adjust whitespace in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lapets committed Sep 29, 2024
1 parent f5088e7 commit 544f9e0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/test_blooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class Test_blooms_methods(TestCase):
for item_length in itertools.chain(range(8), range(8, 64, 13)):
# The saturation tests for this combination of lengths are encapsulated in the
# methods below.
def method_for_saturation_test(test, blooms_len=blooms_length, item_len=item_length):
def method_for_saturation_test(
test: Test_blooms_methods,
blooms_len: int = blooms_length,
item_len: int = item_length
):
"""
Test the accuracy of the approximations returned by the method for
calculating the saturation of an instance.
Expand All @@ -53,9 +57,9 @@ def method_for_saturation_test(test, blooms_len=blooms_length, item_len=item_len
# number of insertions exceeds the number of distinct bytes-like objects of
# the current length.
for item_count in [
2**k
2 ** k
for k in range(2, blooms_len.bit_length() - 2)
if 2**k < 256**item_len
if 2 ** k < 256 ** item_len
]:
# Set the random seed at this point to ensure that tests are deterministic
# (and consistent regardless of the order in which they are executed).
Expand Down Expand Up @@ -93,7 +97,11 @@ def method_for_saturation_test(test, blooms_len=blooms_length, item_len=item_len

# The capacity tests for this combination of lengths are encapsulated in the
# methods below.
def method_for_capacity_test(test, blooms_len=blooms_length, item_len=item_length):
def method_for_capacity_test(
test: Test_blooms_methods,
blooms_len: int = blooms_length,
item_len: int = item_length
):
"""
Test the accuracy of the approximations returned by the method for
calculating the capacity of an instance.
Expand All @@ -103,9 +111,9 @@ def method_for_capacity_test(test, blooms_len=blooms_length, item_len=item_lengt
# number of insertions exceeds the number of distinct bytes-like objects of
# the current length.
for item_count in [
2**k
2 ** k
for k in range(2, blooms_len.bit_length() - 2)
if 2**k < 256**item_len
if 2 ** k < 256**item_len
]:
# Set the random seed at this point to ensure that tests are deterministic
# (and consistent regardless of the order in which they are executed).
Expand Down

0 comments on commit 544f9e0

Please sign in to comment.