Université du Québec à Montréal, Montreal, Quebec, Canada
November 18-21, 2017
Test-driven development can be hard -- the more exhaustive your tests are, the more challenging they can be to comprehend and iterate on. This talk explores a side-project-turned-testing-framework for describing networks using ascii art, turning long and boring tests into beautiful snippets.
s---p----1---nx / | | / | 0---f 6l-a c-- / | \--k / ua | 9e q \ | / \-r7z jud \ | m y \ | v-ow
This tool came about after we observed a funny pattern in the tests we were writing for our power-systems software: developers would smudge together 40+ lines of xml (or an equivalent number of lines of variables and class instantiations) in order to make a test with the cases they were interested in, and then they would draw a little ascii-shorthand of the network they had just described, because they wanted to be able to remember what they had made later on. This led us to wonder, "What if those diagrams were the test?". So we build an ascii-diagram parser that made networks into networkx graphs, and then we built a tool to turn a networkx graph into a set of objects representing a power grid.
The parser has been released as an open source project at https://github.com/AnjoMan/asciigraf and is available on pypi under the name asciigraf
Anton is a Toronto based python developer, and he spends his time modeling power systems using python and nonlinear optimizers. He has a Masters degree from the University of Toronto in the field of electrical engineering.