コード例 #1
0
ファイル: UnitCellTest.py プロジェクト: tomgriffinstfc/mantid
    def test_to_string(self):
        unit = UnitCell(3, 3, 3)
        expected_str = "UnitCell with lattice parameters: a = 3 b = 3 c = 3 "\
                       "alpha = 90 beta = 90 gamma = 90"
        expected_repr = "UnitCell(3, 3, 3, 90, 90, 90)"

        self.assertEqual(expected_str, str(unit))
        self.assertEqual(expected_repr, unit.__repr__())

        newUnit = eval(unit.__repr__())
        self.assertEqual(unit.a(), newUnit.a())
        self.assertEqual(unit.b(), newUnit.b())
        self.assertEqual(unit.c(), newUnit.c())

        self.assertEqual(unit.alpha(), newUnit.alpha())
        self.assertEqual(unit.beta(), newUnit.beta())
        self.assertEqual(unit.gamma(), newUnit.gamma())
コード例 #2
0
ファイル: UnitCellTest.py プロジェクト: mantidproject/mantid
    def test_to_string(self):
        unit = UnitCell(3,3,3)
        expected_str = "UnitCell with lattice parameters: a = 3 b = 3 c = 3 "\
                       "alpha = 90 beta = 90 gamma = 90"
        expected_repr = "UnitCell(3, 3, 3, 90, 90, 90)"

        self.assertEqual(expected_str, str(unit))
        self.assertEqual(expected_repr, unit.__repr__())

        newUnit = eval(unit.__repr__())
        self.assertEqual(unit.a(), newUnit.a())
        self.assertEqual(unit.b(), newUnit.b())
        self.assertEqual(unit.c(), newUnit.c())

        self.assertEqual(unit.alpha(), newUnit.alpha())
        self.assertEqual(unit.beta(), newUnit.beta())
        self.assertEqual(unit.gamma(), newUnit.gamma())