Пример #1
0
    def test_from_cod(self):
        """ Test building a Crystal object from the COD """
        # revision = None and latest revision should give the same Crystal
        c = Crystal.from_cod(1521124)
        c2 = Crystal.from_cod(1521124, revision=176429)

        self.assertEqual(c, c2)
Пример #2
0
 def test_from_cod_new_dir(self):
     """ Test that a cache dir is created by Crystal.from_cod """
     with tempfile.TemporaryDirectory() as temp_dir:
         download_dir = Path(temp_dir) / "test_cod"
         self.assertFalse(download_dir.exists())
         c = Crystal.from_cod(1521124, download_dir=download_dir)
         self.assertTrue(download_dir.exists())
Пример #3
0
def test_from_cod_new_dir():
    """Test that a cache dir is created by Crystal.from_cod"""
    with tempfile.TemporaryDirectory() as temp_dir:
        download_dir = Path(temp_dir) / "test_cod"
        assert not download_dir.exists()
        c = Crystal.from_cod(1521124, download_dir=download_dir)
        assert download_dir.exists()