Below you will find pages that utilize the taxonomy term “Python”
November 12, 2020
Posts of the Week 11/06/20
https://rootsofprogress.org/immunization-from-inoculation-to-rna-vaccines
When you get your covid shot (probably in 2021), take a moment to think back on the 300 years of progress that got us to this point.
https://github.com/wbolster/emacs-python-black
This is an Emacs package to make it easy to reformat Python code using black, the uncompromising Python code formatter.
read moreMay 19, 2020
Unit tests and system clock
It took me way to long to learn this. Your code (and their unit tests) should inject the system clock as a dependency.
An example, let’s say you have a service that writes a record to the database with the system clock.
public void save(String userName) { long currentTimeMs = System.currentTimeMillis(); User user = User.builder() .name(userName) .updateTimeMs(currentTimeMs); database.save(user); } How would you test this? You can inject a mock database instance and use it to verify that it got a User object.
read more