def test_sgate_float(self, n): """Test Sgate.power(<float>) method. """ result = SGate().power(n) expected = self.results[n] self.assertEqual(result.label, 's^%s' % n) self.assertIsInstance(result, UnitaryGate) assert_array_almost_equal(result.to_matrix(), expected)
def test_sgate_int(self, n): """Test Sgate.power(n) method with n as integer. """ result = SGate().power(n) self.assertEqual(result.label, 's^%s' % n) self.assertIsInstance(result, UnitaryGate) assert_array_almost_equal(result.to_matrix(), matrix_power(SGate().to_matrix(), n))