Esempio n. 1
0
    def test_seed_generator(self):
        # This fails here: seed_generator_a = SeedGenerator(self.seed)
        np.random.seed(self.seed)
        seed1 = np.random.randint(low=1, high=10000000)
        seed2 = np.random.randint(low=1, high=10000000)

        # And works only here:
        seed_generator_a = SeedGenerator(self.seed)
        seed_generator_a.seed_random_function = mock_random_seed_function

        print seed_generator_a.request_seed()
        print seed_generator_a.seeds
        self.assertRaises(ValueError, seed_generator_a.request_seed)

        seed_generator_a = SeedGenerator(self.seed)
        self.assertEqual(seed_generator_a.request_seed(), seed1)
        self.assertEqual(seed_generator_a.request_seed(), seed2)
Esempio n. 2
0
    def test_seed_generator(self):
        # This fails here: seed_generator_a = SeedGenerator(self.seed)
        np.random.seed(self.seed)
        seed1 = np.random.randint(low=1, high=10000000)
        seed2 = np.random.randint(low=1, high=10000000)

        # And works only here:
        seed_generator_a = SeedGenerator(self.seed)
        seed_generator_a.seed_random_function = mock_random_seed_function

        print seed_generator_a.request_seed()
        print seed_generator_a.seeds
        self.assertRaises(ValueError, seed_generator_a.request_seed)

        seed_generator_a = SeedGenerator(self.seed)
        self.assertEqual(seed_generator_a.request_seed(), seed1)
        self.assertEqual(seed_generator_a.request_seed(), seed2)
Esempio n. 3
0
 def __init__(self, seed):
     SeedGenerator.__init__(self, seed=seed)
Esempio n. 4
0
 def __init__(self, name, seed):
     self.name = name
     self.seed = seed
     self.seed_generator = SeedGenerator(self.seed)
     self.properties = {}
     self.regions = {}
Esempio n. 5
0
 def __init__(self, seed):
     SeedGenerator.__init__(self, seed=seed)