[Piglit] [PATCH 3/5] log.py: Makes method names clearer

Dylan Baker baker.dylan.c at gmail.com
Tue Aug 12 14:34:09 PDT 2014


From: Dylan Baker <baker.dylan.c at gmail.com>

This replace _summary, _running, and _percent with _format*. This makes
the methods easier to understand, especially with names like __summary
also used in the class

v2: - rename _print_* to _format_* (Ilia)

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..02b3526 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -78,17 +78,17 @@ class Log(object):
         # newline.
         sys.stdout.flush()
 
-    def _summary(self):
+    def _format_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 _format_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 _format_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._format_percent(),
+            running=self._format_running(),
+            summary=self._format_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._format_percent(),
+            summary=self._format_summary()))
-- 
2.0.4



More information about the Piglit mailing list