Skip to content
Snippets Groups Projects
Commit 67217b0e authored by Stephen Finucane's avatar Stephen Finucane
Browse files

columns: Useful __str__, __repr__ implementation


The default implementations for __str__ and __repr__ are rubbish.

  >>> from osc_lib.cli import format_columns
  >>> str(format_columns.DictColumn({'foo': 'bar'}))
  '<osc_lib.cli.format_columns.DictColumn object at 0x7f6e26771e40>'
  >>> repr(format_columns.DictColumn({'foo': 'bar'}))
  '<osc_lib.cli.format_columns.DictColumn object at 0x7f6e26b57ac0>'

Make it useful.

  >>> from osc_lib.cli import format_columns
  >>> str(format_columns.DictColumn({'foo': 'bar'}))
  "foo='bar'"
  >>> repr(format_columns.DictColumn({'foo': 'bar'}))
  "DictColumn({'foo': 'bar'})"

This helps when testing as the reason for mismatches will be more
obvious.

Change-Id: I8b8598875f896cb3dbf417515d377e7758b3b98b
Signed-off-by: default avatarStephen Finucane <sfinucan@redhat.com>
parent 9614d304
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment