def test_solver_filtering_in_client(self): # base client self.assertTrue(Client.is_solver_handled(solver_object('test'))) self.assertTrue(Client.is_solver_handled(solver_object('c4-sw_'))) self.assertTrue(Client.is_solver_handled(None)) # qpu client self.assertTrue(QPUClient.is_solver_handled(solver_object('test'))) self.assertFalse(QPUClient.is_solver_handled(solver_object('c4-sw_'))) self.assertFalse(QPUClient.is_solver_handled(None)) # sw client self.assertFalse( SoftwareClient.is_solver_handled(solver_object('test'))) self.assertTrue( SoftwareClient.is_solver_handled(solver_object('c4-sw_'))) self.assertFalse(SoftwareClient.is_solver_handled(None))
def test_solver_filtering_in_client(self): # base client self.assertTrue(Client.is_solver_handled(solver_object('test', 'qpu'))) self.assertTrue( Client.is_solver_handled(solver_object('test', 'software'))) self.assertTrue( Client.is_solver_handled(solver_object('test', 'hybrid'))) self.assertTrue( Client.is_solver_handled(solver_object('test', 'whatever'))) self.assertTrue(Client.is_solver_handled(None)) # qpu client self.assertTrue( QPUClient.is_solver_handled(solver_object('test', 'qpu'))) self.assertFalse( QPUClient.is_solver_handled(solver_object('test', 'software'))) self.assertFalse( QPUClient.is_solver_handled(solver_object('test', 'hybrid'))) self.assertFalse( QPUClient.is_solver_handled(solver_object('test', 'whatever'))) self.assertFalse(QPUClient.is_solver_handled(None)) # sw client self.assertFalse( SoftwareClient.is_solver_handled(solver_object('test', 'qpu'))) self.assertTrue( SoftwareClient.is_solver_handled(solver_object('test', 'software'))) self.assertFalse( SoftwareClient.is_solver_handled(solver_object('test', 'hybrid'))) self.assertFalse( SoftwareClient.is_solver_handled(solver_object('test', 'whatever'))) self.assertFalse(SoftwareClient.is_solver_handled(None)) # hybrid client self.assertFalse( HybridClient.is_solver_handled(solver_object('test', 'qpu'))) self.assertFalse( HybridClient.is_solver_handled(solver_object('test', 'software'))) self.assertTrue( HybridClient.is_solver_handled(solver_object('test', 'hybrid'))) self.assertFalse( HybridClient.is_solver_handled(solver_object('test', 'whatever'))) self.assertFalse(HybridClient.is_solver_handled(None))
def test_solver_with_category_missing(self): # client type filtering support self.assertTrue( QPUClient.is_solver_handled(solver_object('solver', cat=''))) self.assertTrue( SoftwareClient.is_solver_handled(solver_object('c4-sw_x', cat=''))) self.assertTrue( HybridClient.is_solver_handled(solver_object('hybrid_x', cat=''))) # derived properties are correct self.assertTrue(solver_object('solver', cat='').qpu) self.assertFalse(solver_object('solver', cat='').software) self.assertFalse(solver_object('solver', cat='').hybrid) self.assertFalse(solver_object('c4-sw_x', cat='').qpu) self.assertTrue(solver_object('c4-sw_x', cat='').software) self.assertFalse(solver_object('c4-sw_x', cat='').hybrid) self.assertFalse(solver_object('hybrid_x', cat='').qpu) self.assertFalse(solver_object('hybrid_x', cat='').software) self.assertTrue(solver_object('hybrid_x', cat='').hybrid)