Ejemplo n.º 1
0
class UnitCellBuilderTest(unittest.TestCase):
    def setUp(self):
        self.builder = UnitCellBuilder()

    def test_getUnitCell_invalid(self):
        invalid_no_a = {u"_cell_length_b": u"5.6"}
        self.assertRaises(RuntimeError, self.builder._getUnitCell, cifData={})
        self.assertRaises(RuntimeError, self.builder._getUnitCell, cifData=invalid_no_a)

    def test_getUnitCell_cubic(self):
        cell = {u"_cell_length_a": u"5.6"}

        self.assertEqual(self.builder._getUnitCell(cell), "5.6 5.6 5.6 90.0 90.0 90.0")

    def test_getUnitCell_tetragonal(self):
        cell = {u"_cell_length_a": u"5.6", u"_cell_length_c": u"2.3"}

        self.assertEqual(self.builder._getUnitCell(cell), "5.6 5.6 2.3 90.0 90.0 90.0")

    def test_getUnitCell_orthorhombic(self):
        cell = {u"_cell_length_a": u"5.6", u"_cell_length_b": u"1.6", u"_cell_length_c": u"2.3"}

        self.assertEqual(self.builder._getUnitCell(cell), "5.6 1.6 2.3 90.0 90.0 90.0")

    def test_getUnitCell_hexagonal(self):
        cell = {u"_cell_length_a": u"5.6", u"_cell_length_c": u"2.3", u"_cell_angle_gamma": u"120.0"}
        cell_errors = {u"_cell_length_a": u"5.6(1)", u"_cell_length_c": u"2.3(1)", u"_cell_angle_gamma": u"120.0"}

        self.assertEqual(self.builder._getUnitCell(cell), "5.6 5.6 2.3 90.0 90.0 120.0")
        self.assertEqual(self.builder._getUnitCell(cell_errors), "5.6 5.6 2.3 90.0 90.0 120.0")
Ejemplo n.º 2
0
class UnitCellBuilderTest(unittest.TestCase):
    def setUp(self):
        self.builder = UnitCellBuilder()

    def test_getUnitCell_invalid(self):
        invalid_no_a = {u'_cell_length_b': u'5.6'}
        self.assertRaises(RuntimeError, self.builder._getUnitCell, cifData={})
        self.assertRaises(RuntimeError, self.builder._getUnitCell, cifData=invalid_no_a)

    def test_getUnitCell_cubic(self):
        cell = {u'_cell_length_a': u'5.6'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 5.6 5.6 90.0 90.0 90.0')

    def test_getUnitCell_tetragonal(self):
        cell = {u'_cell_length_a': u'5.6', u'_cell_length_c': u'2.3'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 5.6 2.3 90.0 90.0 90.0')

    def test_getUnitCell_orthorhombic(self):
        cell = {u'_cell_length_a': u'5.6', u'_cell_length_b': u'1.6', u'_cell_length_c': u'2.3'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 1.6 2.3 90.0 90.0 90.0')

    def test_getUnitCell_hexagonal(self):
        cell = {u'_cell_length_a': u'5.6', u'_cell_length_c': u'2.3', u'_cell_angle_gamma': u'120.0'}
        cell_errors = {u'_cell_length_a': u'5.6(1)', u'_cell_length_c': u'2.3(1)', u'_cell_angle_gamma': u'120.0'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 5.6 2.3 90.0 90.0 120.0')
        self.assertEqual(self.builder._getUnitCell(cell_errors), '5.6 5.6 2.3 90.0 90.0 120.0')
Ejemplo n.º 3
0
class UnitCellBuilderTest(unittest.TestCase):
    def setUp(self):
        self.builder = UnitCellBuilder()

    def test_getUnitCell_invalid(self):
        invalid_no_a = {u'_cell_length_b': u'5.6'}
        self.assertRaises(RuntimeError, self.builder._getUnitCell, cifData={})
        self.assertRaises(RuntimeError, self.builder._getUnitCell, cifData=invalid_no_a)

    def test_getUnitCell_cubic(self):
        cell = {u'_cell_length_a': u'5.6'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 5.6 5.6 90.0 90.0 90.0')

    def test_getUnitCell_tetragonal(self):
        cell = {u'_cell_length_a': u'5.6', u'_cell_length_c': u'2.3'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 5.6 2.3 90.0 90.0 90.0')

    def test_getUnitCell_orthorhombic(self):
        cell = {u'_cell_length_a': u'5.6', u'_cell_length_b': u'1.6', u'_cell_length_c': u'2.3'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 1.6 2.3 90.0 90.0 90.0')

    def test_getUnitCell_hexagonal(self):
        cell = {u'_cell_length_a': u'5.6', u'_cell_length_c': u'2.3', u'_cell_angle_gamma': u'120.0'}
        cell_errors = {u'_cell_length_a': u'5.6(1)', u'_cell_length_c': u'2.3(1)', u'_cell_angle_gamma': u'120.0'}

        self.assertEqual(self.builder._getUnitCell(cell), '5.6 5.6 2.3 90.0 90.0 120.0')
        self.assertEqual(self.builder._getUnitCell(cell_errors), '5.6 5.6 2.3 90.0 90.0 120.0')
Ejemplo n.º 4
0
 def setUp(self):
     self.builder = UnitCellBuilder()
Ejemplo n.º 5
0
 def setUp(self):
     self.builder = UnitCellBuilder()