Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
# Basic test to verify we can get valid return datadeftest_calculate_tax(self):
state ='MN'
gross =100000salary=75000
json_data = json.dumps({'state': state,'gross': gross,'salary':salary})response= c.post('/content/vote/', json_data,
content_type='application/json',
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
self.assertEqual(response.status_code,302)# this is OK.print(response.content)
self.assertEqual(response.content,2)
When I right click the test name in PyCharm and select the "Run Test" option, though, I get the below error. I have no idea what it means or how to fix it ...
Traceback(most recent call last):File"/Applications/PyCharm.app/Contents/helpers/pycharm/django_test_manage.py", line 56,in<module>
django.setup()File"/Users/davea/Documents/workspace/myproject/venv/lib/python3.7/site-packages/django/__init__.py", line 24,in setup
apps.populate(settings.INSTALLED_APPS)File"/Users/davea/Documents/workspace/myproject/venv/lib/python3.7/site-packages/django/apps/registry.py", line 114,in populate
app_config.import_models()File"/Users/davea/Documents/workspace/myproject/venv/lib/python3.7/site-packages/django/apps/config.py", line 211,in import_models
self.models_module = import_module(models_module_name)File"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127,in import_module
return _bootstrap._gcd_import(name[level:], package, level)File"", line 1006,in _gcd_import
File"", line 983,in _find_and_load
File"", line 967,in _find_and_load_unlocked
File"", line 677,in _load_unlocked
File"", line 728,in exec_module
File"", line 219,in _call_with_frames_removed
File"/Users/davea/Documents/workspace/myproject/web/models.py", line 2,
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
2 years ago
I'm using Django, Python 3.7. and PyCharm 2018.3.5. I have this test file ...
It looks like the below
When I right click the test name in PyCharm and select the "Run Test" option, though, I get the below error. I have no idea what it means or how to fix it ...