Skip to content

Fix for fixed_sequence, and fix for an output bug. #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyresttest/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def seq_generator():
i = 0
while(True):
yield my_list[i]
i += 1
if i == len(my_list):
i = 0
return seq_generator
Expand Down
7 changes: 6 additions & 1 deletion pyresttest/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,13 @@ def validate(self, body=None, headers=None, context=None):

if not comparison:
failure = Failure(validator=self)

output_extracted_val = extracted_val
if self.comparator_name in ("count_eq", "length_eq"):
output_extracted_val = len(extracted_val)

failure.message = "Comparison failed, evaluating {0}({1}, {2}) returned False".format(
self.comparator_name, extracted_val, expected_val)
self.comparator_name, output_extracted_val, expected_val)
failure.details = self.get_readable_config(context=context)
failure.failure_type = FAILURE_VALIDATOR_FAILED
return failure
Expand Down