示例#1
0
def test_extract_formats():
    r"""Test extract_formats."""
    test_str = ['%10s\t%5.2f\t%4d\t%g%+gj']
    test_fmt = [['%10s', '%5.2f', '%4d', '%g%+gj']]
    for s, f in zip(test_str, test_fmt):
        nt.assert_equal(serialize.extract_formats(s), f)
        nt.assert_equal(serialize.extract_formats(backwards.unicode2bytes(s)),
                        [backwards.unicode2bytes(i) for i in f])
示例#2
0
 def fmts(self):
     r"""list: Formats in format string."""
     return serialize.extract_formats(self.format_str)
示例#3
0
 def field_formats(self):
     r"""list: Format codes for each field in the format string."""
     if self.format_str is None:
         return []
     return serialize.extract_formats(self.format_str)