[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libosinfo] [PATCH osinfo-db 2/7] tests: osinfo: Add some pretty printing for Os objects



On Wed, 2019-03-20 at 17:53 -0400, Cole Robinson wrote:
> str(osobj) now prints the shortid, this helps debugging
> 
> Signed-off-by: Cole Robinson <crobinso redhat com>
> ---
>  tests/osinfo.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/osinfo.py b/tests/osinfo.py
> index 0c58f0a..454170d 100644
> --- a/tests/osinfo.py
> +++ b/tests/osinfo.py
> @@ -27,6 +27,9 @@ class Os():
>          self._root = root
>          self._cache = {}
>  
> +    def __repr__(self):
> +        return "<%s shortid=%s>" % (self.__class__.__name__,
> self.shortid)
> +
>      def _get_id(self):
>          return self._root.get('id')
>      internal_id = _cache_property(_get_id)


Reviewed-by: Fabiano Fidêncio <fidencio redhat com>

Best Regards,
-- 
Fabiano Fidêncio


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]