示例#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)