-
Notifications
You must be signed in to change notification settings - Fork 268
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
Improve our test for reset and fix some test bugs. #1098
Conversation
bf0b571
to
771d503
Compare
This has now caught a few other bugs. Thankfully they are only bugs in our tests: A number of tests for stochastic strategies were not seeded, and I offset the seed in my test update. Essentially this fixes those tests. |
This is a fork of #1097 (as one of the bugs is fixed there). |
We were only playing against Random, @marcharper found and fixed a bug via hypothesis on it here: #1097 This catches the bug too: Axelrod(pass-match-attributes) ✗: python -m unittest axelrod.tests.strategies.test_titfortat ...............................................................................F................................................................ ====================================================================== FAIL: test_reset_history_and_attributes (axelrod.tests.strategies.test_titfortat.TestNTitsForMTats) Make sure resetting works correctly. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vince/src/Axelrod/axelrod/tests/strategies/test_player.py", line 411, in test_reset_history_and_attributes self.assertEqual(player, clone) AssertionError: N Tit(s) For M Tat(s): 3, 2 != N Tit(s) For M Tat(s): 3, 2
This just changes the name of the test so that the default test is not used.
Meta is a random strategy but the test was not seeded.
It is a random strategy, that will act randomly if `-1<f<1`, `f` is calculated as the sin(...), at the start of that game, it is sin(0) which means it acts randomly from the start.
It was passing (by luck) and actually was a test for a case that is tested lower down anyway (it's when the strategy's score is low).
771d503
to
1d83778
Compare
|
||
# Check for -0.3 < f < 0.3, random | ||
actions = [(D, C), (C, C), (D, C), (D, C), | ||
(C, C), (D, C)] + [(C, C)] * 6 + [(D, C),(D, C)] + [(C, C)] * 7 | ||
self.versus_test(opponent=axelrod.MockPlayer(actions=[C]), expected_actions=actions, seed=6) | ||
self.versus_test(opponent=axelrod.MockPlayer(actions=[C]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use cooperator and defector for these tests?
Looks fine to me, just a comment about using Cooperator and Defector if possible. |
Good call. Done. 👍 |
We were only playing against Random, @marcharper found and fixed a bug via
hypothesis on it here:
#1097
This catches the bug too: