Пример #1
0
    def setUp(self):
        if self.use_numpy:
            bitstrings.use_numpy()
        else:
            bitstrings.use_pure_python()

        self.bitstring = bitstrings.BitString('10010101')  # 149
Пример #2
0
    def setUp(self):
        if self.use_numpy:
            bitstrings.use_numpy()
        else:
            bitstrings.use_pure_python()

        self.bitstring = bitstrings.BitString('10010101')  # 149
Пример #3
0
 def test_using(self):
     if self.use_numpy:
         self.assertTrue(bitstrings.using_numpy())
         self.assertTrue('numpy' in bitstrings.BitString.__module__)
         bitstrings.use_pure_python()
         self.assertFalse(bitstrings.using_numpy())
         self.assertTrue('python' in bitstrings.BitString.__module__)
         bitstrings.use_numpy()
         self.assertTrue(bitstrings.using_numpy())
         self.assertTrue('numpy' in bitstrings.BitString.__module__)
         logging.disable(logging.CRITICAL)
         try:
             xcs.test(scenario=xcs.scenarios.MUXProblem(1000))
         finally:
             logging.disable(logging.NOTSET)
     else:
         self.assertFalse(bitstrings.using_numpy())
         self.assertTrue('python' in bitstrings.BitString.__module__)
         logging.disable(logging.CRITICAL)
         try:
             xcs.test(scenario=xcs.scenarios.MUXProblem(1000))
         finally:
             logging.disable(logging.NOTSET)
Пример #4
0
 def test_using(self):
     if self.use_numpy:
         self.assertTrue(bitstrings.using_numpy())
         self.assertTrue('numpy' in bitstrings.BitString.__module__)
         bitstrings.use_pure_python()
         self.assertFalse(bitstrings.using_numpy())
         self.assertTrue('python' in bitstrings.BitString.__module__)
         bitstrings.use_numpy()
         self.assertTrue(bitstrings.using_numpy())
         self.assertTrue('numpy' in bitstrings.BitString.__module__)
         logging.disable(logging.CRITICAL)
         try:
             xcs.test(scenario=xcs.scenarios.MUXProblem(1000))
         finally:
             logging.disable(logging.NOTSET)
     else:
         self.assertFalse(bitstrings.using_numpy())
         self.assertTrue('python' in bitstrings.BitString.__module__)
         logging.disable(logging.CRITICAL)
         try:
             xcs.test(scenario=xcs.scenarios.MUXProblem(1000))
         finally:
             logging.disable(logging.NOTSET)