Пример #1
0
class TestCubicPhase:
    """Tests for cubic phase function"""
    gamma = 0.242
    H, t = cubic_phase(gamma)

    def test_identity(self):
        """Test alpha=0 gives identity"""
        _, t = cubic_phase(0)
        assert t == 0

    def test_hermitian(self, hbar):
        """Test output is hermitian"""
        assert is_hermitian(self.H)
        assert is_hermitian(get_boson_operator(self.H, hbar=hbar))

    def test_gaussian(self):
        """Test output is gaussian"""
        res = self.H.is_gaussian()
        assert not res

    def test_time(self):
        """Test time parameter is correct"""
        assert self.t == self.gamma
Пример #2
0
 def test_identity(self):
     """Test alpha=0 gives identity"""
     self.logTestName()
     _, t = cubic_phase(0)
     self.assertEqual(t, 0)
Пример #3
0
 def setUp(self):
     """Parameters"""
     self.hbar = 2
     self.gamma = 0.242
     self.H, self.t = cubic_phase(self.gamma)
Пример #4
0
 def test_identity(self):
     """Test alpha=0 gives identity"""
     _, t = cubic_phase(0)
     assert t == 0