...
 
Commits (2)
# Unit Tests by Peter Steinbach (steinbac@mpi-cbg.de)
This hacky hour is dedicated to performant python code. I will present minimal best practises and their performance impact.
## Target audience
I expect the audience to have a minimal understanding of the core concepts of python for defining loops, handling strings, using lists and if-else blocks.
## Recommended Reading
TBA
## Attendees: ?
# Dependencies
For the most part of this hackyhour you will need to have [py.test](https://docs.pytest.org/en/latest/) installed. Further, I'll base many, if not all demos on the [pytest-benchmark](https://github.com/ionelmc/pytest-benchmark) extension.
There are several ways [to install it](https://docs.pytest.org/en/latest/getting-started.html). I recommend `pip3` as the examples will be python3 based.
``` bash
$ pip3 install --user pytest pytest-benchmark
```
import pytest
@pytest.fixture
def lorem():
text = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque interdum consectetur commodo. Nullam dictum metus vitae metus interdum scelerisque. Etiam pharetra ullamcorper commodo. Aenean feugiat cursus eros, nec pharetra nulla euismod eu. Vivamus quis odio enim. Aliquam erat volutpat. Praesent non mattis lacus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque accumsan dictum augue lobortis placerat.
Integer ac vulputate lorem, sit amet vestibulum quam. Aenean vel semper odio. Proin dictum est vitae placerat faucibus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent maximus, dolor a tincidunt consectetur, ligula orci porttitor mi, at finibus risus nisi a felis. Vivamus volutpat augue felis, at faucibus quam mollis sit amet. Donec pellentesque congue nulla faucibus pellentesque. Mauris molestie risus aliquet, euismod sapien quis, semper lectus. Ut at risus vel magna molestie finibus eget ac lectus. Pellentesque mollis fringilla urna et accumsan. Integer eu quam scelerisque, dictum diam gravida, commodo mauris. Nulla odio nibh, placerat a orci gravida, blandit venenatis justo.
Aliquam ac nulla euismod, condimentum lacus et, varius augue. Donec feugiat lacinia ipsum, at posuere ipsum bibendum eu. Maecenas cursus augue purus, id rutrum ex scelerisque quis. Curabitur fermentum porttitor nunc sed."""
return text.split()