Skip to content
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

Refactor tests for player. #1034

Merged
merged 2 commits into from
Jun 1, 2017
Merged

Refactor tests for player. #1034

merged 2 commits into from
Jun 1, 2017

Conversation

drvinceknight
Copy link
Member

This is a minor refactor of some warnings that were occurring:

  • A simulate_play that was using a fake history;
  • A warning from the generator equality

The change to the way the generator equality was being run is based on
this error:

.........../home/vince/src/Axelrod/axelrod/player.py:165:
PendingDeprecationWarning: generator 'Player.__eq__.<locals>.<genexpr>'
raised StopIteration
  for _ in range(200))):

Addresses #884

return False
for _ in range(200):
try:
if not next(generator) == next(other_generator):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this != ? If the generator were emitting booleans this could be confusing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the cause of the warning from the prior implementation?

Copy link
Member Author

@drvinceknight drvinceknight May 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call on !=.

I believe the warning was thrown by an attribute that was not a cycle and ran out of elements. I didn't check through for which one that was though (this change seemed to make sense anyway to me).

This is a minor refactor of some warnings that were occurring:

- A `simulate_play` that was using a fake history;
- A warning from the generator equality

The change to the way the generator equality was being run is based on
this error:

```python
.........../home/vince/src/Axelrod/axelrod/player.py:165:
PendingDeprecationWarning: generator 'Player.__eq__.<locals>.<genexpr>'
raised StopIteration
  for _ in range(200))):
```

Addresses #884
@marcharper marcharper merged commit 0fdac5f into master Jun 1, 2017
@marcharper marcharper deleted the 884-player branch July 19, 2017 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants