StringIO instead might make this test cleaner