(NLP) Course 3 week1 the unittests.py incorrect?

In Week 1: Explore the BBC News archive, in the unittests.py during test code:

unittests.test_parse_data_from_file(parse_data_from_file)

t = test_case()
if len(labels) != 2225:
t.failed = True
t.msg = “Incorrect number of labels for the full dataset. Make sure you didn’t include the header.”
t.want = 5
t.got = len(labels)
cases.append(t)
We only have at most 5 items in the labels, why 2225 here. This causes the test to fail.

And in a later test on number of labels of bbc-text-minimal.csv, there are really on 4 items in the labels, so we should not expect 5 here.

Never mind, I finally understand why that’s the case. The original code has no error.

1 Like