A short update this week, which perhaps belies the amount of work I got done last week; I think I managed to check off a roadmap item every day for the past seven days, which feels great. Some of the quarantine insularity is definitely getting to me, though — I’ve felt pretty dang tired today and yesterday, and am taking a mental health day tomorrow to noodle around in the house and do some reading.
(It is hard for me to remember how and when to rest, sometimes. Working from home exacerbates that.)
I’ve been investing a lot in my email validation infrastructure lately, and this weekend brought a big addition: I found a less-than-documented approach of validating Google / GSuite addresses and wanted to get it into production relatively quickly to see if it would work at scale. (It did!)
The validation suite is now comprised of ten decoupled validators, which is just enough to justify some refactoring and DRY-ing. So I had some fun building out a common test suite which means all I need to do to test a validator is define a list of ‘valid’ and ‘invalid’ emails:
class ExtantGmailUsernameValidatorTestCase(ValidatorTestCaseWrapper.ValidatorTestCase): GOOD_EMAILS = [ "firstname.lastname@example.org", "email@example.com", "firstname.lastname@example.org", "email@example.com", "firstname.lastname@example.org", "email@example.com", ] BAD_EMAILS = [ "firstname.lastname@example.org", "email@example.com", "firstname.lastname@example.org", "email@example.com", ] def validator_class(self): return ExtantGmailUsernameValidator
(These are the actual test emails I use, because I am not a serious programmer.)
ValidatorTestCase is what’s doing the interesting work, iterating through each one in a networked and non-networked (to speed up the tests) environment. This is the classic case of “I spent more time on the refactor than I will ever gain from its fruits”, but it was fun! Spending time writing legible tests is probably more of a meditative exercise than a net productivity gain when your codebase has a single author, but meditative exercises are good.
I find myself so bored with the whole “three callout sections then some illustrations to bind them together” exercise. Do people use these? I know the answer is yes; or at least the answer is I do not do a good job communicating my features, as evinced by the number of people asking if I support multiple newsletters or paid subscriptions, but…I digress. I need to just go heads down and actually write some damn marketing copy.