def test_to_csv(self, some_table: Table):
     out = io.StringIO()
     some_table.to_csv(out)
     assert out.getvalue() == dedent("""\
         **some_table;;
         success glory
         a;b;c
         -;text;m
         -;gnu;3
         4.0;gnat;{{(+ x y)}}
         
         """)
 def test_to_csv_with_format(self, some_table_with_digits: Table):
     out = io.StringIO()
     some_table_with_digits.to_csv(out)
     print(out.getvalue())
     assert out.getvalue() == dedent("""\
         **some_table_with_digits;;
         success glory
         a;b;c
         -;text;m
         -;gnu;3.2341e+00
         $4.12;gnat;2.3000e-02
         $0.40;galah;4.2010e+01
         $0.04;gentoo;4.3232e+04
         $4,000.04;gerbil;4.3232e+04
         
         """)
 def test_to_csv_nonstring_colnames_and_destinations(self):
     # PS-53 Bundle.to_csv() fails when column names are not strings
     nonstring_colnames = [1.234, 666.0, 42.0]
     nonstring_destinations = [1984, 2001.2001]
     df = pd.DataFrame(data=[[nan, 'gnu', 3], [4, 'gnat', '{{(+ x y)}}']], columns=nonstring_colnames)
     col_specs = {n: ColumnMetadata(Unit(u)) for n, u in zip(nonstring_colnames, ['-', 'text', 'm'])}
     t = Table(df=df, name='some_table', col_specs=col_specs,
               destinations=nonstring_destinations)
     out = io.StringIO()
     t.to_csv(out)
     assert out.getvalue() == dedent("""\
         **some_table;;
         1984 2001.2001
         1.234;666.0;42.0
         -;text;m
         -;gnu;3
         4.0;gnat;{{(+ x y)}}
         
         """)