-
Notifications
You must be signed in to change notification settings - Fork 25
Formative feedback #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| Return - nothing | ||
| """ | ||
|
|
||
| with open(TASK_FILE,"a", encoding="utf-8") as file: |
There was a problem hiding this comment.
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 | ||
|
|
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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. | |||
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Between 1 and what?
|
@TomCumber Comments above. Nice work. |
Good work! Some nice little feature enhancements to help the user with (almost all) tests edited to match.
Keep doing the following:
To improve:
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...