Permalink
Browse files

Fix linear qubit operator tests being machine-dependent (#490)

* fix test

* fix test
  • Loading branch information...
kevinsung committed Dec 6, 2018
1 parent e031750 commit 1f86781822cd19ba12fd000bee9e5e0afac748a0
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/openfermion/utils/_linear_qubit_operator_test.py
@@ -34,7 +34,7 @@ class LinearQubitOperatorOptionsTest(unittest.TestCase):
def setUp(self):
"""LinearQubitOperatorOptions test set up."""
self.processes = 6
self.processes = multiprocessing.cpu_count()
self.options = LinearQubitOperatorOptions(self.processes)
def test_init(self):
@@ -49,7 +49,8 @@ def test_get_processes_small(self):
def test_get_processes_large(self):
"""Tests get_processes() with a large num."""
self.assertEqual(self.options.get_processes(20), self.processes)
self.assertEqual(self.options.get_processes(2*self.processes),
self.processes)
def test_invalid_processes(self):
"""Tests with invalid processes since it's not positive."""
@@ -225,7 +226,8 @@ def test_init(self):
default_processes)
# Generated variables.
self.assertEqual(len(self.linear_operator.qubit_operator_groups), 3)
self.assertEqual(len(self.linear_operator.qubit_operator_groups),
min(multiprocessing.cpu_count(), 3))
self.assertEqual(QubitOperator.accumulate(
self.linear_operator.qubit_operator_groups), self.qubit_operator)

0 comments on commit 1f86781

Please sign in to comment.