Reformat Wikiq_Unit_Test.py
Separate out reformatting from editing. Signed-off-by: Will Beason <willbeason@gmail.com>
This commit is contained in:
parent
9c5bf577e6
commit
09a84e7d11
@ -9,6 +9,7 @@ import tracemalloc
|
||||
|
||||
tracemalloc.start()
|
||||
|
||||
|
||||
# with / without pwr DONE
|
||||
# with / without url encode DONE
|
||||
# with / without collapse user DONE
|
||||
@ -99,7 +100,6 @@ class Test_Wikipedia(unittest.TestCase):
|
||||
assert_frame_equal(test, baseline, check_like=True)
|
||||
|
||||
|
||||
|
||||
class Test_Basic(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@ -136,7 +136,6 @@ class Test_Basic(unittest.TestCase):
|
||||
baseline = pd.read_table(baseline_file)
|
||||
assert_frame_equal(test, baseline, check_like=True)
|
||||
|
||||
|
||||
def test_collapse_user(self):
|
||||
test_filename = "collapse-user_" + self.wikiq_out_name
|
||||
test_file = os.path.join(self.test_output_dir, test_filename)
|
||||
@ -167,7 +166,6 @@ class Test_Basic(unittest.TestCase):
|
||||
proc = subprocess.Popen(call, stdout=subprocess.PIPE, shell=True)
|
||||
proc.wait()
|
||||
|
||||
|
||||
copyfile(self.call_output, test_file)
|
||||
|
||||
baseline_file = os.path.join(".", self.baseline_output_dir, test_filename)
|
||||
@ -187,7 +185,6 @@ class Test_Basic(unittest.TestCase):
|
||||
proc = subprocess.Popen(call, stdout=subprocess.PIPE, shell=True)
|
||||
proc.wait()
|
||||
|
||||
|
||||
copyfile(self.call_output, test_file)
|
||||
|
||||
baseline_file = os.path.join(".", self.baseline_output_dir, test_filename)
|
||||
@ -207,7 +204,6 @@ class Test_Basic(unittest.TestCase):
|
||||
proc = subprocess.Popen(call, stdout=subprocess.PIPE, shell=True)
|
||||
proc.wait()
|
||||
|
||||
|
||||
copyfile(self.call_output, test_file)
|
||||
|
||||
baseline_file = os.path.join(".", self.baseline_output_dir, test_filename)
|
||||
@ -218,7 +214,6 @@ class Test_Basic(unittest.TestCase):
|
||||
test = test.reindex(columns=sorted(test.columns))
|
||||
assert_frame_equal(test, baseline, check_like=True)
|
||||
|
||||
|
||||
def test_url_encode(self):
|
||||
test_filename = "url-encode_" + self.wikiq_out_name
|
||||
|
||||
@ -255,9 +250,7 @@ class Test_Malformed(unittest.TestCase):
|
||||
self.input_dir = "dumps"
|
||||
self.input_file = os.path.join(".", self.input_dir, self.infile)
|
||||
|
||||
|
||||
def test_malformed_noargs(self):
|
||||
|
||||
call = self.base_call.format(self.input_file, self.test_output_dir)
|
||||
proc = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
proc.wait()
|
||||
@ -265,6 +258,7 @@ class Test_Malformed(unittest.TestCase):
|
||||
errlines = str(errs).split("\\n")
|
||||
self.assertEqual(errlines[-2], 'xml.etree.ElementTree.ParseError: no element found: line 1369, column 0')
|
||||
|
||||
|
||||
class Test_Stdout(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@ -278,7 +272,6 @@ class Test_Stdout(unittest.TestCase):
|
||||
self.baseline_output_dir = "baseline_output"
|
||||
|
||||
def test_noargs(self):
|
||||
|
||||
call = self.base_call.format(self.input_file)
|
||||
print(call)
|
||||
proc = subprocess.run(call, stdout=subprocess.PIPE, shell=True)
|
||||
@ -291,6 +284,7 @@ class Test_Stdout(unittest.TestCase):
|
||||
baseline = pd.read_table(baseline_file)
|
||||
assert_frame_equal(test, baseline, check_like=True)
|
||||
|
||||
|
||||
class Test_Regex(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@ -333,14 +327,11 @@ class Test_Regex(unittest.TestCase):
|
||||
"-CP 'WP:EVADE' -CPl wp_evade"
|
||||
]
|
||||
|
||||
|
||||
self.cap_inputs_list = [
|
||||
"-RP 'Li Chevalier' -RPl li_cheval -CP '(?P<letter>\\b[a-zA-Z]{3}\\b)|(?P<number>\\b\\d+\\b)|(?P<cat>\\bcat\\b)' -CPl three",
|
||||
"-CP '(?P<a>\\bTestCaseA\\b)|(?P<b>\\bTestCaseB\\b)|(?P<c>\\bTestCaseC\\b)|(?P<d>\\bTestCaseD\\b)' -CPl testcase -RP '(?P<npov>npov|NPOV)|(?P<neutral>neutral point of view)' -RPl npov"
|
||||
]
|
||||
|
||||
|
||||
|
||||
def test_regex_inputs(self):
|
||||
for input in self.bad_inputs_list:
|
||||
call = self.base_call.format(self.input_file)
|
||||
@ -378,7 +369,6 @@ class Test_Regex(unittest.TestCase):
|
||||
assert_frame_equal(test, baseline, check_like=True)
|
||||
print(i)
|
||||
|
||||
|
||||
def test_capturegroup_regex(self):
|
||||
for i, input in enumerate(self.cap_inputs_list):
|
||||
test_filename = "capturegroup_{0}_{1}.tsv".format(self.wikiq_out_name[:-4], str(i))
|
||||
|
Loading…
Reference in New Issue
Block a user