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

ResultsSet __eq__ fails unexpectedly #1286

Closed
marcharper opened this issue Mar 2, 2020 · 5 comments · Fixed by #1301
Closed

ResultsSet __eq__ fails unexpectedly #1286

marcharper opened this issue Mar 2, 2020 · 5 comments · Fixed by #1301
Labels

Comments

@marcharper
Copy link
Member

Specifically I found an example (2 player tournament with 2 turns) that has nan eigenmoses results, and the comparison of nan to nan fails in __eq__.

@marcharper marcharper added the bug label Mar 2, 2020
@drvinceknight
Copy link
Member

Cool, could you paste the inputs here (assuming it's a specific 2 player tournament).

Tagging #1283 so we know that there might be slight overlap.

@marcharper
Copy link
Member Author

It was this test but with only two players and two turns:

    @given(seed=integers(min_value=1, max_value=4294967295))
    @settings(max_examples=5, deadline=None)
    def test_seeding_equality(self, seed):
        """Tests that a tournament with a given seed will return the
        same results each time."""
        rng = axelrod.RandomGenerator(seed=seed)
        players = [axelrod.Random(rng.random()) for _ in range(8)]
        tournament1 = axelrod.Tournament(
            name=self.test_name,
            players=players,
            game=self.game,
            turns=3,
            repetitions=100,
            seed=seed
        )
        tournament2 = axelrod.Tournament(
            name=self.test_name,
            players=players,
            game=self.game,
            turns=3,
            repetitions=100,
            seed=seed
        )
        results1 = tournament1.play(processes=2)
        results2 = tournament2.play(processes=2)
        self.assertEqual(results1.ranked_names, results2.ranked_names)

@drvinceknight
Copy link
Member

Ah ok cool, hypothesis should print out the specific inputs for which it failed (it stores them in a db ) when run and we should add that in as a test case when we fix.

@marcharper
Copy link
Member Author

I think it's not wrong so much as in that case there were not enough vengeful actions to have a well-defined eigenmoses score, hence the NaN values. We'll just need to check for NaN or == instead of just ==.

@drvinceknight
Copy link
Member

Yeah sounds like it should be relatively easy to sort out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants