gradescope / autograder_samples

Examples of autograders for running on Gradescope
https://gradescope-autograders.readthedocs.io/en/latest/
82 stars 164 forks source link

Upgrade GS Python Autograder Examples to Use Python 3 #61

Closed ThaumicMekanism closed 3 years ago

ThaumicMekanism commented 3 years ago

This PR updates the existing examples to no longer use python2 and instead use python3. Due to differences in how strings are managed, any diff case uses byte object instead of converting it to a normal string.

ibrahima commented 3 years ago

Tagging @SyntaxBlitz in case you're able to get to this sooner than I am.

I haven't looked into this, but does doing byte comparisons vs strings affect how Unicode is handled? Thanks!

SyntaxBlitz commented 3 years ago

I've tested this a bit with different encodings. Since this compares byte-for-byte, you don't have the opportunity to, say, load the reference file as UTF-16 and compare it against a string from the (not-UTF-16) subprocess output, but that was going to be a pain in python2 anyway. As long as the reference file is encoded sensibly, it seems to work fine.