-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I'm trying to complete the project "K-means from scratch" stage 1/6. When trying to "check" my solution in PyCharm, I get the following stack trace;
Traceback (most recent call last):
File "%USERPRFILE%\AppData\Local\Programs\Python\Python312\Lib\unittest\loader.py", line 33, in testFailure
raise self._exception
ImportError: Failed to import test module: tests
Traceback (most recent call last):
File "%USERPRFILE%\AppData\Local\Programs\Python\Python312\Lib\unittest\loader.py", line 137, in loadTestsFromName
module = __import__(module_name)
^^^^^^^^^^^^^^^^^^^^^^^
File "%USERPRFILE%\PycharmProjects\K-Means Clustering from Scratch\K-Means Clustering from Scratch\task\test\tests.py", line 2, in <module>
from hstest.stage_test import List
ImportError: cannot import name 'List' from 'hstest.stage_test' (C:\Users\spzhu\PycharmProjects\K-Means Clustering from Scratch\.venv\Lib\site-packages\hstest\stage_test.py)
I had a look in "%USERPRFILE%\PycharmProjects\K-Means Clustering from Scratch\K-Means Clustering from Scratch\task\test\tests.py", and the issue is the line from hstest.stage_test import List. The hstest.stage_test seems to be depreciated and replaced by the class StageTest, so I just removed the line and then replaced all instances of List with the built-in list.
This appears to work when I run the file "%USERPRFILE%\PycharmProjects\K-Means Clustering from Scratch\K-Means Clustering from Scratch\task\test\tests.py" on its own, as I now get an error saying the test is failed due to incorrect output. However, when I run the check from the course in PyCharm, the file reverts to original and still includes from hstest.stage_test import List.