Posts tagged "code":
fnc: interactive text-based fossil user interface
This is a long overdue announcement for a project I have been developing for a while.
[...]netcalc update: it's 2019 after all
After receiving a request from Martin on the misc@ mailing list to make IPv6 the default version for netcalc, I decided to implement my original idea to dynamically detect which version IP address the user specifies so that no switch is necessary. It was a trivial change but definitely an improvement; and, like Martin remarked, "it's 2019 after all." Despite the fact that IPv4 still traffics most of the Internet with approximately 75% coverage, any encouragement to implement its successor should be the default position.
[...]ipv4 and ipv6 cidr subnet calculator
UPDATE: netcalc
has a newer version available.
unit testing with pytest—not easily ignored
Days 10–12 of the 100 Days of Code
TalkPython course is dedicated to unit
testing with pytest
, and is a foison of information. Prior to this, I had
very little experience with pytest
but found it less intuitive than the
language itself, and somewhat obscure—at least at first. I think, however, this
was because of trying to concinnate the actual tests—much like I would any
program—rather than simply hardcoding the input and expected output of a
function's given test with the parametrize
decorator. Instead, I would
essentially try to rewrite the function logic differently to reproduce the
desired behaviour. This, however, is counterintuitive because I'm introducing
another possibility for faulty logic, albeit in the test, so if the tests pass
but both models are flawed, I'd never know. On top of which, I was testing a
command-line driven app, so figuring out how to write tests for sys.argv
input required additional understanding—and I'm still not entirely sure I've
written the most efficient tests but I did achieve complete coverage so I'm
satisfied with the result. Nonetheless, what I want to share is the apparent
discrepancy between the advertised way to ignore or exclude directories in
your project repository, and what's actually needed to get it done.