Failing the commented tests in HW4req

gabriel.bustamante (2540 points)
3 5 20
asked Nov 19, 2021 in HW4 by gabriel.bustamante (2,540 points)
edited Nov 20, 2021 by gabriel.bustamante

I finished HW4req and submitted it for testing, passing 9/9 tests. Just out of curiosity I de-commented the tests "04" and "09" in and ran the tests on my machine, but they both fail, generating ever so slightly different matrices than expected (and incorrect sync indexes). In the case of test 04 the difference is the position of a single "1".

Could it be an issue with my program or are those tests simply disfunctional remnants?

EDIT: I wrote "In the case of test 09" but I meant "test 04", the Divine Comedy one; Fixed

UPDATE: After some debugging it seems that it is an encoding(?) issue: in test 04 the sequence ?"—"  in line ~600 somehow turns into â inside my function, instead of space, which in turn returns an extra empty string, causing an extra zero to be added next to this "word". A similar issue appears with test 09 on a larger scale. I had trouble working with particular characters before, even though my text editor is set to UTF-8 and # -*- coding: utf-8 -*-  is still in line 1 of my program; I'll find a solution eventually. Everything turned out fine in the VM so far, hopefully it'll keep this way!


4 Answers

Best answer
andrea.sterbini (172340 points)
510 927 1776
answered Nov 19, 2021 by andrea.sterbini (172,340 points)
selected Nov 20, 2021 by gabriel.bustamante
I bet you are using Windows

The magic word is..... encoding
gabrimat (5630 points)
2 2 25
commented Nov 20, 2021 by gabrimat (5,630 points)
Worked for me!
nane.harutyunyan (790 points)
0 0 4
answered Nov 19, 2021 by nane.harutyunyan (790 points)
Try checking in the text where exactly the difference between the matrices occurs; as in one case it is a single '1', it might be because of not transforming/removing a special character.
gianluca5539 (9820 points)
3 6 44
answered Nov 19, 2021 by gianluca5539 (9,820 points)
There is one character that happens in just one test, I don't remember which test, but it could be because of that if one test fails
ruben.ciranni (4650 points)
7 13 31
answered Nov 20, 2021 by ruben.ciranni (4,650 points)
Are you spectifying the utf8 encoding when you open the file?