[Piglit] [PATCH 3/5] log.py: Makes method names clearer
Ilia Mirkin
imirkin at alum.mit.edu
Thu Jul 3 14:16:59 PDT 2014
On Thu, Jul 3, 2014 at 4:56 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> This replace _summary, _running, and _percent with _print*. This makes
> the methods easier to understand, especially with names like __summary
> also used in the class
Certainly _summary vs __summary is a little confusing. OTOH I would
expect _print_summary to... print the summary. How about
_format_summary? (Or some other clever name.)
>
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
> framework/log.py | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/framework/log.py b/framework/log.py
> index c967028..d6ab735 100644
> --- a/framework/log.py
> +++ b/framework/log.py
> @@ -78,17 +78,17 @@ class Log(object):
> # newline.
> sys.stdout.flush()
>
> - def _summary(self):
> + def _print_summary(self):
> """ return a summary of the statuses """
> return ", ".join("{0}: {1}".format(k, self.__summary[k])
> for k in sorted(self.__summary))
>
> - def _running(self):
> + def _print_running(self):
> """ return running tests """
> return "Running Test(s): {}".format(
> " ".join([str(x).zfill(self.__pad) for x in self.__running]))
>
> - def _percent(self):
> + def _print_percent(self):
> """ return the percentage of tess completed """
> return "{0}/{1}".format(str(self.__complete).zfill(self.__pad),
> str(self.__total).zfill(self.__pad))
> @@ -96,9 +96,9 @@ class Log(object):
> def __print(self, name, result):
> """ Do the actual printing """
> self._write_output(self.__output.format(
> - percent=self._percent(),
> - running=self._running(),
> - summary=self._summary(),
> + percent=self._print_percent(),
> + running=self._print_running(),
> + summary=self._print_summary(),
> name=name,
> result=result))
>
> @@ -149,5 +149,5 @@ class Log(object):
>
> def summary(self):
> self._write_output(self.__summary_output.format(
> - percent=self._percent(),
> - summary=self._summary()))
> + percent=self._print_percent(),
> + summary=self._print_summary()))
> --
> 2.0.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list