import subprocess
from shutil import copyfile
import pandas as pd
-from pandas.util.testing import assert_frame_equal
+from pandas.testing import assert_frame_equal
from io import StringIO
# with / without pwr DONE
# as a test let's make sure that we get equal data frames
test = pd.read_table(test_file)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
def test_WP_namespaces(self):
print(os.path.abspath('.'))
num_wrong_ns = sum(~ test.namespace.isin({0,1}))
self.assertEqual(num_wrong_ns, 0)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
def test_WP_revert_radius(self):
print(os.path.abspath('.'))
num_wrong_ns = sum(~ test.namespace.isin({0,1}))
self.assertEqual(num_wrong_ns, 0)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
test = pd.read_table(test_file)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
def test_collapse_user(self):
baseline_file = os.path.join(".", self.baseline_output_dir, test_filename)
test = pd.read_table(test_file)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
def test_pwr_segment(self):
test_filename = "persistence_segment_" + self.wikiq_out_name
test = pd.read_table(test_file)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
def test_pwr_legacy(self):
test_filename = "persistence_legacy_" + self.wikiq_out_name
test = pd.read_table(test_file)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
def test_pwr(self):
test_filename = "persistence_" + self.wikiq_out_name
test = pd.read_table(test_file)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+
+ test = test.reindex(columns=sorted(test.columns))
+ assert_frame_equal(test,baseline, check_like=True)
def test_url_encode(self):
baseline_file = os.path.join(".", self.baseline_output_dir, test_filename)
test = pd.read_table(test_file)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+
+ test = test.reindex(columns=sorted(test.columns))
+ assert_frame_equal(test,baseline, check_like=True)
class Test_Malformed(unittest.TestCase):
self.wiki = 'twinpeaks'
self.wikiq_out_name = self.wiki + ".tsv"
self.test_output_dir = os.path.join(".", "test_output")
- self.call_output = os.path.join(self.test_output_dir, self.wikiq_out_name)
+ self.call_output = os.path.join(self.test_output_dir, self.wikiq_out_name)
self.infile = "{0}.xml.7z".format(self.wiki)
self.base_call = "../wikiq {0} -o {1}"
def test_noargs(self):
call = self.base_call.format(self.input_file)
+ print(call)
proc = subprocess.run(call,stdout=subprocess.PIPE,shell=True)
outs = proc.stdout.decode("utf8")
print(baseline_file)
test = pd.read_table(StringIO(outs))
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test,baseline)
+ assert_frame_equal(test,baseline, check_like=True)
class Test_Regex(unittest.TestCase):
baseline_file = os.path.join(".", self.baseline_output_dir, test_filename)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test, baseline)
+ assert_frame_equal(test, baseline, check_like=True)
print(i)
baseline_file = os.path.join(".", self.baseline_output_dir, test_filename)
baseline = pd.read_table(baseline_file)
- assert_frame_equal(test, baseline)
+ assert_frame_equal(test, baseline, check_like=True)
if __name__ == '__main__':