Naming conventions - makersacademy/simpleassettracker GitHub Wiki
To keep things consistent and running smoothly we use the following naming conventions:
Tests
For test classes, we add Test
to the end of the name. For example, the class for testing the dashboard is class DashboardTest
. We have discovered that if the test class name is the same as the model and you are using the test database in your tests, then it causes a problem as the database query looks in the test class for what it needs rather than in the model.
For test methods, it's important to start the name with test_
as this is how the python manage.py test ...
command knows it is a test that needs running. For example, test_do_not_count_mobiles
.
Test files also need to start with the word test eg test_dashboard.py
for the same reason as stated in test methods above.
Classes and methods
We are using the standard Python/Django naming conventions in our Python files and the JavaScript naming conventions in our React/JS files. Examples:
Python: class Dashboard():
and def count_mobiles():
React/JS: class AssetDisplay{}
and showAsset() {}