def test_file_resolve_path(self): f = File(filepath='~/Desktop/../Lenna.png') self.assertEqual(f.path, path.expanduser('~/Lenna.png')) f.path = '~/test' self.assertEqual(f.path, path.expanduser('~/test')) f.path = '../../testdata/Lenna.png' self.assertEqual(f.path, '../../testdata/Lenna.png')
def test_wrong_filepath(self): f = File() f.path = '/non-exist-file' f.make_tuple()