Option 1 is sufficient. I just need a way to reproduce the result, not recover the history. show() works for dictionaries, but not for other objects like DataFrames. For these, it behaves more like display, which gives a human-readable (but not Julia-readable) version.
The function I write will generate the object. However, I am software regression testing, so I want to make sure that the output stays the same between versions. So, I’d like to save the output from a previous version. Test cases might involve very large data frames, so it isn’t feasible to type out the definition of the intended output. One workaround might be to compare the test display of the DataFramse using show(), but I’d like to directly compare DataFrames for equality.
just save the output to a string, re-direct stdout, and compare? this is a very common test in Julia
how else are you gonna test across versions? if you use some auto generation, such as repr, supposedly it will always equal to the other end of the equality right? namely, the current repr you want to test.
so you always have to hard-code previous, known good output – isn’t that the whole point?
Thanks, this should be sufficient. Still, I’d prefer to hard code two DataFrame definitions rather than hard code the text output from the display. Since Julia is homoiconic, I’d be interested in seeing a version of repr() or show() that handles a DataFrame the way a Dict is handled. I’ll accept your answer if I can’t find something like that. Many thanks!