def test_error_if_space_group_missing_from_dict(self):
     crystal_info = {"a": 4.99, "b": 4.99, "c": 17.002,
                     "alpha": 90, "beta": 90, "gamma": 120}
     with pytest.raises(ValueError) as exception_info:
         Crystal.from_dict(crystal_info)
     assert str(exception_info.value) == \
         "Parameter: 'space_group' missing from input dictionary"
    def test_atomic_sites_loaded_if_given(self):
        crystal_info = {"a": 4.99, "b": 4.99, "c": 17.002,
                        "alpha": 90, "beta": 90, "gamma": 120,
                        "space_group": "R -3 c H", "sites": CALCITE_ATOMIC_SITES}

        calcite = Crystal.from_dict(crystal_info)
        expected_sites = {name: Site(ion, position)
                          for name, (ion, position) in CALCITE_ATOMIC_SITES.items()}
        assert calcite.sites == expected_sites
    def test_can_create_crystal_from_dictionary(self):
        crystal_info = {"a": 4.99, "b": 4.99, "c": 17.002,
                        "alpha": 90, "beta": 90, "gamma": 120,
                        "space_group": "R -3 c H"}
        calcite = Crystal.from_dict(crystal_info)

        assert calcite.a == 4.99
        assert calcite.b == 4.99
        assert calcite.c == 17.002
        assert calcite.alpha == 90
        assert calcite.beta == 90
        assert calcite.gamma == 120
        assert calcite.space_group == "R -3 c H"