MRG: convert bug dir to unit tests. add unit test for csv output

adds unit tests as discussed in #251