def test_register_valid_class(self): """Test backend registration for a custom valid backend.""" backend_name = register_backend(ValidBackend) # Check that it has been added to the list of backends. self.assertIn(backend_name, _REGISTERED_BACKENDS.keys()) self.assertEqual(_REGISTERED_BACKENDS[backend_name].cls, ValidBackend) # Second registration should fail as it is already registered. with self.assertRaises(QISKitError): register_backend(ValidBackend)