Newline and test fixes, added TODO

This commit is contained in:
2023-03-10 21:12:35 +01:00
parent c9df6b5408
commit d3396af668
4 changed files with 33 additions and 6 deletions

29
TODO.md Normal file
View 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

View File

@@ -295,7 +295,7 @@ class DynamoFile(File):
def write_file(self) -> None:
"""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)
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:
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()
self.header_data = {}
@@ -508,7 +508,7 @@ class PythonFile(File):
def write_file(self) -> None:
"""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)

View File

@@ -33,8 +33,6 @@ class TestFile(unittest.TestCase):
self.assertEqual(the_file.dirpath, pathlib.Path(INPUT_DIR))
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.assertEqual(the_file.extension, ".dyn")
self.assertFalse(the_file.modified)

View File

@@ -59,5 +59,5 @@ class TestPythonNode(unittest.TestCase):
self.assertEqual(node.id, "1c5d99792882409e97e132b3e9f814b0")
self.assertEqual(node.engine, "CPython3")
self.assertEqual(node.checksum, "bf0f039ef6f11c3043e0821143801d48")
self.assertEqual(node.checksum, "8d9091d24788a6fdfa5e1e109298b50e")