empa-scientific-it / python-tutorial

Material for a Jupyter-based Python tutorial
MIT License
30 stars 9 forks source link

Fixed tests. #223

Closed baffelli closed 4 months ago

baffelli commented 4 months ago

Closing #134.

despadam commented 4 months ago

When executing solution_print_odd() I get ValueError: I/O operation on closed file

despadam commented 4 months ago

When executing solution_print_salutation() I get no output at all.

despadam commented 4 months ago

When executing solution_write_file() I get Failed: Cannot read from inexistent file.

despadam commented 4 months ago

When executing solution_read_write_file() I get FileNotFoundError: [Errno 2] No such file or directory: '...\test_read_write_file_solution_0\\output_file.txt'

baffelli commented 4 months ago

When executing solution_print_odd() I get ValueError: I/O operation on closed file

Good catch, solved in 27fbfd8

baffelli commented 4 months ago

When executing solution_print_salutation() I get no output at all.

There's no test for that exercise because I could find no way to use input in iyptest

baffelli commented 4 months ago

solution_write_file

I changed the error message in 506ac73

baffelli commented 4 months ago

When executing solution_read_write_file() I get FileNotFoundError: [Errno 2] No such file or directory: '...\test_read_write_file_solution_0\\output_file.txt'

I was using pytest.fail instead of assert. This causes a confusing error message which is not properly handled by ipytest. It is now fixed in f0e83ea

baffelli commented 4 months ago

The table of contents should be updated, for example it does not contain exercise 3.

Will also leave some additional comments for errors I came across when trying to execute the exercises.

Done in eaac18c

despadam commented 4 months ago

Hi @baffelli, all exercises run smoothly now, thanks! The only remaining topic is the TOC:

  1. Due to incorrect indentation, the list appears as text instead of links.
  2. Due to the bug we have not fixed, when you have multiple sections with the same title, the script will make all links with the same name point to the same section. Here you have multiple sections named Exercises, so whichever link you click, it will always send you to the first section with this name. A quick solution is to rename them and make each of the Exercises section have a slightly different title.
baffelli commented 4 months ago

Hi @baffelli, all exercises run smoothly now, thanks! The only remaining topic is the TOC:

1. Due to incorrect indentation, the list appears as text instead of links.

2. Due to the bug we have not fixed, when you have multiple sections with the same title, the script will make all links with the same name point to the same section. Here you have multiple sections named `Exercises`, so whichever link you click, it will always send you to the first section with this name. A quick solution is to rename them and make each of the `Exercises` section have a slightly different title.

Thank you for the hint. I cannot reproduce these problems, for me the links work correctly.

despadam commented 4 months ago

Hi @baffelli, all exercises run smoothly now, thanks! The only remaining topic is the TOC:

1. Due to incorrect indentation, the list appears as text instead of links.

2. Due to the bug we have not fixed, when you have multiple sections with the same title, the script will make all links with the same name point to the same section. Here you have multiple sections named `Exercises`, so whichever link you click, it will always send you to the first section with this name. A quick solution is to rename them and make each of the `Exercises` section have a slightly different title.

Thank you for the hint. I cannot reproduce these problems, for me the links work correctly.

No worries. If it's ok then I am taking the liberty to rename the sections so the TOC will work correctly for all