From 990f28b283bce4a524b4e32178f45e40214ee0de Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 22 Dec 2019 14:21:25 -0800 Subject: pig: move count_lines helper to pighelper.py --- pig/tests/pighelper.py | 5 ++++- pig/tests/test_filter_cdx_paper_pdfs.py | 4 +--- pig/tests/test_filter_software.py | 4 +--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pig/tests/pighelper.py b/pig/tests/pighelper.py index 4aa4259..95e0426 100644 --- a/pig/tests/pighelper.py +++ b/pig/tests/pighelper.py @@ -17,6 +17,9 @@ import unittest import subprocess +def count_lines(s): + return len([l for l in s.strip().split('\n') if len(l) > 0]) + class PigTestHelper(unittest.TestCase): @classmethod @@ -50,7 +53,7 @@ class PigTestHelper(unittest.TestCase): return retval def run_pig(self, script_path, in_file, **kwargs): - """Convenience helper around run_pig(). + """Convenience helper around run_pig_raw(). INPUT parameter is set to in_file. OUTPUT parameter is set to a random file. diff --git a/pig/tests/test_filter_cdx_paper_pdfs.py b/pig/tests/test_filter_cdx_paper_pdfs.py index a8ebd9f..c2d2e6b 100644 --- a/pig/tests/test_filter_cdx_paper_pdfs.py +++ b/pig/tests/test_filter_cdx_paper_pdfs.py @@ -1,10 +1,8 @@ import os import unittest -from pighelper import PigTestHelper +from pighelper import PigTestHelper, count_lines -def count_lines(s): - return len([l for l in s.strip().split('\n') if len(l) > 0]) class TestFilterCDXPaperPdfs(PigTestHelper): diff --git a/pig/tests/test_filter_software.py b/pig/tests/test_filter_software.py index f0ea1b6..cce90b4 100644 --- a/pig/tests/test_filter_software.py +++ b/pig/tests/test_filter_software.py @@ -1,10 +1,8 @@ import os import unittest -from pighelper import PigTestHelper +from pighelper import PigTestHelper, count_lines -def count_lines(s): - return len([l for l in s.strip().split('\n') if len(l) > 0]) class TestFilterCDXSoftware(PigTestHelper): -- cgit v1.2.3