def test_masks(self): with open(self.folder+"masks.py", 'w') as fh: fh.write("def f(x): return x") config = Config(base_config_path=self.folder) self.assertEqual("foo", config.get("format_custom")[0]("foo"))
print(i) sys.exit() elif args.func == 'edit': for filename in list(set(args.entries) - set(args.skip)): if args.file: file_id = 'file' elif args.id: file_id = 'id' else: file_id = 'both' editEntry(filename, file_id) sys.exit() elif args.func == 'list': listPapers = tools.listDir(config.get("folder")) listPapers.sort() for paper in listPapers: if tools.getExtension(paper) not in [".pdf", ".djvu"]: continue print(paper) elif args.func == 'search': raise Exception('TODO') elif args.func == 'open': for filename in args.ids: if not openFile(filename): sys.exit("Unable to open file associated " + "to ident "+filename)
def test_set(self): config = Config(base_config_path=self.folder) config.set("foo", "bar") self.assertEqual(config.get("foo"), "bar")
def test_get(self): config = Config(base_config_path=self.folder) self.assertEqual(config.get("proxies"), [''])
def test_masks(self): with open(self.folder + "masks.py", 'w') as fh: fh.write("def f(x): return x") config = Config(base_config_path=self.folder) self.assertEqual("foo", config.get("format_custom")[0]("foo"))
def test_set(self): config = Config(base_config_path=self.folder) config.set("foo", "bar") self.assertEqual(config.get("foo"), "bar")
def test_get(self): config = Config(base_config_path=self.folder) self.assertEqual(config.get("proxies"), [''])