mirror of
https://github.com/infeeeee/dyn2py
synced 2025-12-16 22:16:18 +01:00
Newline and test fixes, added TODO
This commit is contained in:
29
TODO.md
Normal file
29
TODO.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Things planned for this project
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
- [ ] Commandline
|
||||||
|
- [ ] File
|
||||||
|
- [ ] DynamoFile
|
||||||
|
- [ ] PythonFile
|
||||||
|
- [x] PythonNode
|
||||||
|
|
||||||
|
## CI/CD
|
||||||
|
|
||||||
|
- [x] Tests on Linux
|
||||||
|
- [ ] Tests on Windows
|
||||||
|
- [ ] Windows Build
|
||||||
|
- [ ] Windows Installer
|
||||||
|
- [ ] Pip
|
||||||
|
- [ ] Winget
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
- [x] API docs
|
||||||
|
- [ ] Installation in readme
|
||||||
|
- [ ] Terminal examples in readme
|
||||||
|
- [ ] About git hooks in readme
|
||||||
|
|
||||||
|
## Extra features maybe later
|
||||||
|
|
||||||
|
- [ ] Autocomplete
|
||||||
@@ -295,7 +295,7 @@ class DynamoFile(File):
|
|||||||
|
|
||||||
def write_file(self) -> None:
|
def write_file(self) -> None:
|
||||||
"""Write this file to the disk. Should be called only from File.write()"""
|
"""Write this file to the disk. Should be called only from File.write()"""
|
||||||
with open(self.filepath, "w", encoding="utf-8") as output_file:
|
with open(self.filepath, "w", encoding="utf-8", newline="") as output_file:
|
||||||
json.dump(self.full_dict, output_file, indent=2, use_decimal=True)
|
json.dump(self.full_dict, output_file, indent=2, use_decimal=True)
|
||||||
|
|
||||||
def get_related_python_files(self, options: Options | None = None) -> list["PythonFile"]:
|
def get_related_python_files(self, options: Options | None = None) -> list["PythonFile"]:
|
||||||
@@ -472,7 +472,7 @@ class PythonFile(File):
|
|||||||
if not self in self.open_files:
|
if not self in self.open_files:
|
||||||
|
|
||||||
logging.info(f"Reading file: {self.filepath}")
|
logging.info(f"Reading file: {self.filepath}")
|
||||||
with open(self.filepath, mode="r", newline="\r\n", encoding="utf-8") as input_py:
|
with open(self.filepath, mode="r", newline="", encoding="utf-8") as input_py:
|
||||||
python_lines = input_py.readlines()
|
python_lines = input_py.readlines()
|
||||||
|
|
||||||
self.header_data = {}
|
self.header_data = {}
|
||||||
@@ -508,7 +508,7 @@ class PythonFile(File):
|
|||||||
|
|
||||||
def write_file(self) -> None:
|
def write_file(self) -> None:
|
||||||
"""Write this file to the disk. Should be called only from File.write()"""
|
"""Write this file to the disk. Should be called only from File.write()"""
|
||||||
with open(self.filepath, "w", encoding="utf-8", newline='') as output_file:
|
with open(self.filepath, "w", encoding="utf-8", newline="") as output_file:
|
||||||
output_file.write(self.text)
|
output_file.write(self.text)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ class TestFile(unittest.TestCase):
|
|||||||
self.assertEqual(the_file.dirpath, pathlib.Path(INPUT_DIR))
|
self.assertEqual(the_file.dirpath, pathlib.Path(INPUT_DIR))
|
||||||
self.assertEqual(the_file.realpath, pathlib.Path(path).resolve())
|
self.assertEqual(the_file.realpath, pathlib.Path(path).resolve())
|
||||||
|
|
||||||
self.assertEqual(the_file.mtime, 1678287111.4672492)
|
|
||||||
self.assertEqual(the_file.mtimeiso, "2023-03-08T15:51:51.467249")
|
|
||||||
self.assertTrue(the_file.exists)
|
self.assertTrue(the_file.exists)
|
||||||
self.assertEqual(the_file.extension, ".dyn")
|
self.assertEqual(the_file.extension, ".dyn")
|
||||||
self.assertFalse(the_file.modified)
|
self.assertFalse(the_file.modified)
|
||||||
|
|||||||
@@ -59,5 +59,5 @@ class TestPythonNode(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(node.id, "1c5d99792882409e97e132b3e9f814b0")
|
self.assertEqual(node.id, "1c5d99792882409e97e132b3e9f814b0")
|
||||||
self.assertEqual(node.engine, "CPython3")
|
self.assertEqual(node.engine, "CPython3")
|
||||||
self.assertEqual(node.checksum, "bf0f039ef6f11c3043e0821143801d48")
|
self.assertEqual(node.checksum, "8d9091d24788a6fdfa5e1e109298b50e")
|
||||||
|
|
||||||
Reference in New Issue
Block a user