Exemplo n.º 1
0
 def testNextStudyIds(self):
     p = _Phylesystem(repos_dict=self.r)
     mf = p._growing_shard._id_minting_file
     nsi = p._mint_new_study_id()
     self.assertEqual(
         int(nsi.split('_')[-1]) + 1,
         read_as_json(mf)['next_study_id'])
     self.assertTrue(nsi.startswith('zz_'))
Exemplo n.º 2
0
 def testChangedStudies(self):
     p = _Phylesystem(repos_dict=self.r)
     changed = p.get_changed_studies('2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc')
     self.assertEqual(set(['xy_13', 'xy_10']), changed)
     changed = p.get_changed_studies('2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc', ['zz_11'])
     self.assertEqual(set(), changed)
     changed = p.get_changed_studies('2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc', ['zz_112'])
     self.assertEqual(set(), changed)
     self.assertRaises(ValueError, p.get_changed_studies, 'bogus')
Exemplo n.º 3
0
 def testChangedStudies(self):
     p = _Phylesystem(repos_dict=self.r)
     p.pull()  # get the full git history
     changed = p.get_changed_studies('5f50b669cb4867d39e9a85e7fd1e2aa8e9a3242b')
     self.assertEqual({'xy_13', 'xy_10'}, changed)
     changed = p.get_changed_studies('5f50b669cb4867d39e9a85e7fd1e2aa8e9a3242b', ['zz_11'])
     self.assertEqual(set(), changed)
     changed = p.get_changed_studies('5f50b669cb4867d39e9a85e7fd1e2aa8e9a3242b', ['zz_112'])
     self.assertEqual(set(), changed)
     self.assertRaises(ValueError, p.get_changed_studies, 'bogus')
Exemplo n.º 4
0
 def testIterateStudies(self):
     p = _Phylesystem(repos_dict=self.r)
     k = list(p.get_study_ids())
     count = 0
     for study_id, file_path in p.iter_study_filepaths():
         count += 1
     self.assertEqual(count, len(k))
     count = 0
     for study_id, n in p.iter_study_objs():
         count += 1
     self.assertEqual(count, len(k))
Exemplo n.º 5
0
 def testIterateStudies(self):
     p = _Phylesystem(repos_dict=self.r)
     k = list(p.get_study_ids())
     count = 0
     for study_id, file_path in p.iter_study_filepaths():
         count += 1
     self.assertEqual(count, len(k))
     count = 0
     for study_id, n in p.iter_study_objs():
         count += 1
     self.assertEqual(count, len(k))
Exemplo n.º 6
0
 def testChangedStudies(self):
     p = _Phylesystem(repos_dict=self.r)
     changed = p.get_changed_studies(
         '2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc')
     self.assertEqual(set(['xy_13', 'xy_10']), changed)
     changed = p.get_changed_studies(
         '2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc', ['zz_11'])
     self.assertEqual(set(), changed)
     changed = p.get_changed_studies(
         '2d59ab892ddb3d09d4b18c91470b8c1c4cca86dc', ['zz_112'])
     self.assertEqual(set(), changed)
     self.assertRaises(ValueError, p.get_changed_studies, 'bogus')
Exemplo n.º 7
0
 def testChangedStudies(self):
     p = _Phylesystem(repos_dict=self.r)
     p.pull()  # get the full git history
     changed = p.get_changed_studies(
         '5f50b669cb4867d39e9a85e7fd1e2aa8e9a3242b')
     self.assertEqual({'xy_13', 'xy_10'}, changed)
     changed = p.get_changed_studies(
         '5f50b669cb4867d39e9a85e7fd1e2aa8e9a3242b', ['zz_11'])
     self.assertEqual(set(), changed)
     changed = p.get_changed_studies(
         '5f50b669cb4867d39e9a85e7fd1e2aa8e9a3242b', ['zz_112'])
     self.assertEqual(set(), changed)
     self.assertRaises(ValueError, p.get_changed_studies, 'bogus')
Exemplo n.º 8
0
 def testStudyIndexing(self):
     p = _Phylesystem(repos_dict=self.r)
     k = list(p._doc2shard_map.keys())
     k.sort()
     self.assertEqual(k, ['xy_10', 'xy_13', 'zz_11', 'zz_112'])
Exemplo n.º 9
0
 def testStudyIds(self):
     p = _Phylesystem(repos_dict=self.r)
     k = list(p.get_study_ids())
     k.sort()
     self.assertEqual(k, ['xy_10', 'xy_13', 'zz_11', 'zz_112'])
Exemplo n.º 10
0
 def testURL(self):
     p = _Phylesystem(repos_dict=self.r)
     self.assertTrue(p.get_public_url('xy_10').endswith('xy_10.json'))
     self.assertTrue(p.get_public_url('zz_112').endswith('zz_112.json'))
Exemplo n.º 11
0
 def testStudyIndexing(self):
     p = _Phylesystem(repos_dict=self.r)
     k = list(p._study2shard_map.keys())
     k.sort()
     self.assertEqual(k, ['xy_10', 'xy_13', 'zz_11', 'zz_112'])
Exemplo n.º 12
0
 def testInit(self):
     p = _Phylesystem(repos_dict=self.r)
     self.assertEqual(2, len(p._shards))
Exemplo n.º 13
0
def get_test_phylesystem():
    from peyotl.phylesystem.phylesystem_umbrella import _Phylesystem
    r = get_test_repos()
    mi = get_test_phylesystem_mirror_info()
    mi['push']['remote_map'] = {'GitHubRemote': '[email protected]:mtholder'}
    return _Phylesystem(repos_dict=r, mirror_info=mi)
Exemplo n.º 14
0
def get_test_phylesystem():
    from peyotl.phylesystem.phylesystem_umbrella import _Phylesystem
    r = get_test_repos()
    mi = get_test_phylesystem_mirror_info()
    mi['push']['remote_map'] = {'GitHubRemote': '[email protected]:mtholder'}
    return _Phylesystem(repos_dict=r, mirror_info=mi)
Exemplo n.º 15
0
 def testInit(self):
     p = _Phylesystem(repos_dict=self.r)
     self.assertEqual(2, len(p._shards))
Exemplo n.º 16
0
 def testURL(self):
     p = _Phylesystem(repos_dict=self.r)
     self.assertTrue(p.get_public_url('xy_10').endswith('xy_10.json'))
     self.assertTrue(p.get_public_url('zz_112').endswith('zz_112.json'))
Exemplo n.º 17
0
 def testNextStudyIds(self):
     p = _Phylesystem(repos_dict=self.r)
     mf = p._growing_shard._id_minting_file
     nsi = p._mint_new_study_id()
     self.assertEqual(int(nsi.split('_')[-1]) + 1, read_as_json(mf)['next_study_id'])
     self.assertTrue(nsi.startswith('zz_'))
Exemplo n.º 18
0
 def testStudyIds(self):
     p = _Phylesystem(repos_dict=self.r)
     k = list(p.get_study_ids())
     k.sort()
     self.assertEqual(k, ['xy_10', 'xy_13', 'zz_11', 'zz_112'])