def test_supports_operation_argument_types(self): """Checks that device.supports_operations returns the correct result when passed both string and Operation class arguments""" self.logTestName() mock_device = Device() self.assertTrue(mock_device.supports_operation('PauliX')) self.assertTrue(mock_device.supports_operation(qml.PauliX))
def test_supports_operation_exception(self): """check that a the function device.supports_operation raises proper errors if the argument is of the wrong type""" self.logTestName() mock_device = Device() with self.assertRaisesRegex( ValueError, "The given operation must either be a pennylane.Operation class or a string." ): mock_device.supports_operation(3) with self.assertRaisesRegex( ValueError, "The given operation must either be a pennylane.Operation class or a string." ): mock_device.supports_operation(Device)