示例#1
0
class TestMatch(unittest.TestCase):
    """
    Test that the composite method works
    """
    def test_call(self):
        match = matches().example()
        self.assertIsInstance(match, axelrod.Match)

    @given(match=matches(min_turns=10, max_turns=50, min_noise=0, max_noise=1))
    @settings(max_examples=5, max_iterations=20)
    def test_decorator(self, match):

        self.assertIsInstance(match, axelrod.Match)
        self.assertGreaterEqual(len(match), 10)
        self.assertLessEqual(len(match), 50)
        self.assertGreaterEqual(match.noise, 0)
        self.assertLessEqual(match.noise, 1)

    @given(match=matches(min_turns=10, max_turns=50, min_noise=0, max_noise=0))
    @settings(max_examples=5, max_iterations=20)
    def test_decorator_with_no_noise(self, match):

        self.assertIsInstance(match, axelrod.Match)
        self.assertGreaterEqual(len(match), 10)
        self.assertLessEqual(len(match), 50)
        self.assertEqual(match.noise, 0)
示例#2
0
class TestMatch(unittest.TestCase):
    """
    Test that the composite method works
    """
    def test_call(self):
        match, seed = matches().example()
        self.assertTrue(str(seed).startswith('random.seed'))
        self.assertIsInstance(match, axelrod.Match)

    @given(match_and_seed=matches(min_turns=10,
                                  max_turns=50,
                                  min_noise=0,
                                  max_noise=1))
    @settings(max_examples=10, timeout=0)
    def test_decorator(self, match_and_seed):
        match, seed = match_and_seed
        self.assertTrue(str(seed).startswith('random.seed'))

        self.assertIsInstance(match, axelrod.Match)
        self.assertGreaterEqual(len(match), 10)
        self.assertLessEqual(len(match), 50)
        self.assertGreaterEqual(match.noise, 0)
        self.assertLessEqual(match.noise, 1)

    @given(match_and_seed=matches(min_turns=10,
                                  max_turns=50,
                                  min_noise=0,
                                  max_noise=0))
    @settings(max_examples=10, timeout=0)
    def test_decorator_with_no_noise(self, match_and_seed):
        match, seed = match_and_seed
        self.assertTrue(str(seed).startswith('random.seed'))

        self.assertIsInstance(match, axelrod.Match)
        self.assertGreaterEqual(len(match), 10)
        self.assertLessEqual(len(match), 50)
        self.assertEqual(match.noise, 0)
示例#3
0
 def test_call(self):
     match = matches().example()
     self.assertIsInstance(match, axelrod.Match)
示例#4
0
 def test_call(self):
     match = matches().example()
     self.assertIsInstance(match, axelrod.Match)
示例#5
0
 def test_call(self):
     match, seed = matches().example()
     self.assertTrue(str(seed).startswith('random.seed'))
     self.assertIsInstance(match, axelrod.Match)
示例#6
0
 def test_call(self):
     match, seed = matches().example()
     self.assertTrue(str(seed).startswith('random.seed'))
     self.assertIsInstance(match, axelrod.Match)