def test_file(self): path = "./tests/examples/collie.jpg" target_path = TargetPath(path) self.assertEqual(target_path.get_name(), "collie.jpg") self.assertEqual(target_path.get_path(), path) self.assertEqual(target_path.get_directory(), "./tests/examples") info = target_path.get_info() self.assertEqual(info["st_size"], 19863) self.assertTrue("st_atime" in info) self.assertTrue("st_ctime" in info) self.assertTrue("st_mtime" in info)
def test_directory(self): path = "./tests/examples/testdirectorydonotinsertmoreitems" target_path = TargetPath(path) self.assertEqual(target_path.get_name(), "testdirectorydonotinsertmoreitems") self.assertEqual(target_path.get_path(), path) self.assertEqual(target_path.get_directory(), "./tests/examples") info = target_path.get_info() self.assertTrue("st_atime" in info) self.assertTrue("st_ctime" in info) self.assertTrue("st_mtime" in info)
def _check_sizes(self, target_file: TargetPath): info = target_file.get_info() if target_file.is_file() and "st_size" in info: if IGNORE_MAX in self._params: if self._max_size is None: self._max_size = int(self._params[IGNORE_MAX]) if info["st_size"] >= self._max_size: self._ignore() if IGNORE_MIN in self._params: if self._min_size is None: self._min_size = int(self._params[IGNORE_MIN]) if info["st_size"] <= self._min_size: self._ignore()