def _test(self, args=[], tree=[], tree_exp=[], buffers=[], buffers_exp=[], current_filename=""): for item in tree: dirname = os.path.dirname(item) if dirname != '': os.makedirs(dirname, exist_ok=True) if os.path.isdir(item): continue if item.endswith('/'): os.makedirs(item) continue with open(item, 'w') as file: file.write(item) mockvim = MockVim(current_filename, mock_buffers(buffers)) plugin = Main() plugin.set_vim(mockvim) plugin.setup_log() plugin.move(args) actual = [] for root, dirs, files in os.walk("."): root = root[1:] # drop . if root != "": root = root[1:] # drop / for file in files: actual.append(os.path.join(root, file)) for dir in dirs: if os.path.exists(dir) and not os.listdir(dir): actual.append(dir + "/") self.assertListEqual(tree_exp, actual, "unexpected tree") self.assertListEqual(buffers_exp, mockvim.list_buffers(), "unexecpted buffers")
# -*- coding: utf-8 -*- from plugin import Main if __name__ == "__main__": r = Main().query('en cs hello my love') print(r) r = Main().query('en bflm hello my love') print(r)
# -*- coding: utf-8 -*- from plugin import Main if __name__ == "__main__": Main()
# -*- coding: utf-8 -*- from pprint import pprint from plugin import Main if __name__ == '__main__': t = Main().query() pprint(t)
# -*- coding: utf-8 -*- from plugin import Main if __name__ == "__main__": r = Main().query('') print(r)