Skip to content

Conversation

@jhill1
Copy link
Owner

@jhill1 jhill1 commented Apr 28, 2025

Good work! Some nice little feature enhancements to help the user with (almost all) tests edited to match.

Keep doing the following:

  • good coding style, with clear naming conventions and clearly written code
  • thinking about how the user would interact and providing information you think is useful
  • pylint is perfect

To improve:

  • think about your git history; commit atomic changes (e.g. a single function) rather than 2 functions
  • try not to add random changes to a commit
  • Make the commit message more detailed if you are committing several things at once
  • You failed one test
>       assert len(result.stdout) == 72
E       AssertionError: assert 66 == 72
E        +  where 66 = len(b'Your task list:\n1. Item 1\n2. Item 2\n3. Item 3\n4. Item 4\n5. Item 5\n')
E        +    where b'Your task list:\n1. Item 1\n2. Item 2\n3. Item 3\n4. Item 4\n5. Item 5\n' = CompletedProcess(args=['python3', 'todo.py', '-l'], returncode=0, stdout=b'Your task list:\n1. Item 1\n2. Item 2\n3. Item 3\n4. Item 4\n5. Item 5\n', stderr=b'').stdout

test/test_to-do.py:65: AssertionError

You forgot to edit something. However this will be the \r\n thing, so worth thinking how you'd deal with this in reality. You wouldn't lose any marks in the summative for this, but worth trying your code in Linux and seeing what the \r\n things means...

Return - nothing
"""

with open(TASK_FILE,"a", encoding="utf-8") as file:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good code, but does two things in one commit. Split into two commits which means it's easier to unwind a specific set of changes (e.g. the add_tasks)

python/todo.py Outdated

def remove_task(index):
return

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try not to add random white space changes in a commit. Use git diff to see what will be changed and remove any unnecessary changes.


if __name__ == "__main__":
main()
def main():
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random file changed, which has nothing to do with the commit.

expected_list ="1. Item 1\n2. Item 2\n3. Item 3\n4. Item 4\n5. Item 5\n"
result = run(["python","todo.py","-l"], capture_output=True, check=True)
assert len(result.stdout) == 72
#changed number from 50 to account for extra characters from adding "your task list" and r before every \n
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment is good. May need repeating below? Try leave space between # and comment and use correct capitalisation.

Return: nothing
"""
if os.path.exists(TASK_FILE):
with open(TASK_FILE, "r", encoding="utf-8") as file:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try and avoid nested with statement, especially on the same file. This could cause issues depending on the users setup.

@@ -1,3 +1,6 @@
"""
This script defines command-line arguements using the argparse module.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. What does your programe do, not what the command line thing does.

print(f"Task at index {index} removed.")
else:
print(f"Invalid task number: {index}. Please enter a number between 1 and {len(tasks)}.")
print(f"Invalid task number: {index}.Enter a number between 1")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between 1 and what?

@jhill1
Copy link
Owner Author

jhill1 commented Apr 28, 2025

@TomCumber Comments above. Nice work.

@jhill1 jhill1 closed this Apr 28, 2025
@jhill1 jhill1 reopened this May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants