Ejemplo n.º 1
0
 def test__find_database_filename(self):
     # If doesn't exist
     self.assertEqual(
         paths._find_db(Path("abc/myfilename.txt"),
                        filename="myfilename.txt"),
         {},
     )
     tmpdir = tempfile.TemporaryDirectory()
     dir_path = Path(tmpdir.name) / "myfolder"
     file_path = dir_path / "myfilename.txt"
     dir_path.mkdir()
     file_path.touch()
     self.assertEqual(
         paths._find_db(file_path, filename="myfilename.txt"),
         collections.defaultdict(list, {"myfolder": [file_path]}),
     )
     tmpdir.cleanup()
Ejemplo n.º 2
0
 def test__find_database(self):
     for d in self.dirs:
         a = sorted(
             str(val) for vals in paths._find_db(
                 self.dirs[d].name,
                 maxdepth=None,
                 break_on_first=False,
             ).values() for val in vals)
         b = sorted(str(x) for x in self.dbs[d])
         self.assertListEqual(a, b)
Ejemplo n.º 3
0
 def test__find_database(self):
     for d in self.dirs:
         a = sorted(
             map(
                 str,
                 flatten_list_list(
                     paths._find_db(
                         self.dirs[d].name,
                         maxdepth=None,
                         break_on_first=False,
                     ).values()),
             ))
         b = sorted(map(str, self.dbs[d]))
         self.assertListEqual(a, b)