def test_transform_path_to_file(self): file_path = Path(self.file_str) # Non-existent paths don't get transformed to File. self.assertTrue(isinstance(file_path.transform(), Path))
def test_transform_path_to_dir(self): dir_path = Path(self.path_str) # Non-existent paths don't get transformed to Dir. self.assertTrue(isinstance(dir_path.transform(), Path))
def test_abs_path(self): d = Path(self.temp_dir).transform() self.assertTrue(isinstance(d, Dir)) pathabs = str(d.abspath()) osabs = os.path.join(os.getcwd(), self.temp_dir) self.assertEqual(pathabs, osabs)
def test_transform_path_to_file(self): file_path = Path(self.filename) self.assertEqual(file_path.transform(), File(self.filename)) # Comparing equality of Path and File only compares their string paths. # Check that object was properly transformed using isinstance. self.assertTrue(isinstance(file_path.transform(), File))
def test_transform_path_to_dir(self): dir_path = Path(self.temp_dir) self.assertEqual(dir_path.transform(), Dir(self.temp_dir)) # Comparing equality of Path and Dir only compares their string paths. # Check that object was properly transformed using isinstance. self.assertTrue(isinstance(dir_path.transform(), Dir))