dnt preserve order and verbose
@@ -36,7 +36,21 @@ class TestKGTKFilter(unittest.TestCase):
Q47158_path = 'data/Q47158_non_edge.tsv'
cli_entry("kgtk", "ifexists", "-i", self.file_path, "--filter-on", Q47158_path, "-o",
f'{self.temp_dir}/Q47158.tsv', "--input-keys", "node1", "--filter-keys", "heading", "--mode", "NONE",
- "--preserve-order", "--cache-input")
+ "--preserve-order", "--cache-input", "--verbose")
+
+ f = open(f'{self.temp_dir}/Q47158.tsv')
+ lines = f.readlines()
+ # strip off the \n
+ self.assertEqual(lines[1].strip(), "Q47158-P1014-1 Q47158 P1014 300391257 normal")
+ self.assertEqual(lines[len(lines) - 1].replace('\n', ''),
+ "Q47158-wikipedia_sitelink-9 Q47158 wikipedia_sitelink http://et.wikipedia.org/wiki/Triias ")
+ f.close()
+
+ def test_kgtk_ifexists_not_preserve_order(self):
+ Q47158_path = 'data/Q47158_non_edge.tsv'
+ cli_entry("kgtk", "ifexists", "-i", self.file_path, "--filter-on", Q47158_path, "-o",
+ f'{self.temp_dir}/Q47158.tsv', "--input-keys", "node1", "--filter-keys", "heading", "--mode", "NONE",
+ "--cache-input", "--verbose")
f = open(f'{self.temp_dir}/Q47158.tsv')
lines = f.readlines()
