Exemplo n.º 1
0
 def test_str(self):
     """Test resolve with a string."""
     r = get_path(obj="/../badwolf")
     assert isinstance(r, pathlib.Path)
     if IS_WINDOWS:
         assert format(r).endswith("badwolf")
     else:
         assert format(r) == format("/badwolf")
 def write_output(self, path, rows, columns):
     """Pass."""
     path = get_path(obj=path)
     stream = path.open("w")
     stream.write(codecs.BOM_UTF8.decode("utf-8"))
     writer = csv.DictWriter(
         stream,
         fieldnames=columns,
         lineterminator="\n",
     )
     writer.writerow(dict(zip(columns, columns)))
     writer.writerows(rows)
     stream.close()
     self.spew_info(f"Wrote output to {path}")
Exemplo n.º 3
0
 def test_user(self):
     """Test resolve with ~."""
     r = get_path(obj="~")
     assert isinstance(r, pathlib.Path)
     assert format(r) == format(pathlib.Path.home())
Exemplo n.º 4
0
 def test_pathlib(self):
     """Test resolve with a pathlib.Path."""
     r = get_path(obj=pathlib.Path("."))
     assert isinstance(r, pathlib.Path)