Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Failing the commented tests in HW4req

gabriel.bustamante (2540 points)
3 6 20
in HW4 by (2.5k points)
edited by

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 test01.py 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!

295 views
closed

4 Answers

Best answer
andrea.sterbini (207920 points)
750 1267 2373
by (208k points)
selected by
I bet you are using Windows

The magic word is..... encoding
gabrimat (5630 points)
2 4 25
by (5.6k points)
Worked for me!
n
nane.harutyunyan (790 points)
0 0 4
by (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)
4 6 44
by (9.8k 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)
8 14 31
by (4.7k points)
Are you spectifying the utf8 encoding when you open the file?