コード例 #1
0
ファイル: path_tests.py プロジェクト: bbengfort/mosaic
    def test_relative_depth(self):
        """
        Test the relative depth of two paths.
        """
        p1 = Path('project/fixtures')
        p2 = 'project/fixtures/data/testing/foo.txt'
        p3 = Path('data')

        self.assertEqual(p1.relative_depth(p2), 3)
        self.assertEqual(p1.relative_depth(p3), 1)
コード例 #2
0
ファイル: usage.py プロジェクト: bbengfort/mosaic
def path(val):
    val = Path(val)
    if val.exists() and val.is_dir():
        return str(val.join('mosaic-{}.json'.format(int(time.time()))))
    return str(val)