예제 #1
0
 def test_get_representation_stored(self, cache_env):
     # we can get paths of representations
     bucket = Bucket(str(cache_env.join("cache")))
     res1 = bucket.store_representation(
         str(cache_env / "src1.txt"),
         str(cache_env / "result1.txt"), repr_key=b'mykey')
     res2 = bucket.get_representation(res1)
     assert res1 == "1_1"
     assert res2 == cache_env / "cache" / "repr" / "1" / "1" / "result1.txt"
예제 #2
0
 def test_get_representation_stored(self, cache_env):
     # we can get paths of representations
     bucket = Bucket(str(cache_env.join("cache")))
     res1 = bucket.store_representation(str(cache_env / "src1.txt"),
                                        str(cache_env / "result1.txt"),
                                        repr_key=b'mykey')
     res2 = bucket.get_representation(res1)
     assert res1 == "1_1"
     assert res2 == cache_env / "cache" / "repr" / "1" / "1" / "result1.txt"
예제 #3
0
 def test_get_representation_stored(self):
     # we cannot get unstored representations
     bucket = Bucket(self.workdir)
     res1 = bucket.store_representation(
         self.src_path1, self.result_path1, repr_key=b'mykey')
     exp_repr_path = os.path.join(
         self.workdir, b'repr', b'1', b'1', b'resultfile1')
     res2 = bucket.get_representation(res1)
     self.assertEqual(res1, b'1_1')
     self.assertEqual(res2, exp_repr_path)
     return
예제 #4
0
 def test_get_representation_unstored(self):
     # we cannot get unstored representations
     bucket = Bucket(self.workdir)
     self.assertEqual(bucket.get_representation(b'1_1'), None)
     return
예제 #5
0
 def test_get_representation_unstored(self, tmpdir):
     # we cannot get unstored representations
     bucket = Bucket(str(tmpdir.join("cache")))
     assert bucket.get_representation("1_1") is None
예제 #6
0
 def test_get_representation_unstored(self, tmpdir):
     # we cannot get unstored representations
     bucket = Bucket(str(tmpdir.join("cache")))
     assert bucket.get_representation("1_1") is None