예제 #1
0
파일: test_config.py 프로젝트: Phyks/BMC
 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"))
예제 #2
0
파일: bmc.py 프로젝트: drvinceknight/BMC
                    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)
예제 #3
0
파일: test_config.py 프로젝트: Phyks/BMC
 def test_set(self):
     config = Config(base_config_path=self.folder)
     config.set("foo", "bar")
     self.assertEqual(config.get("foo"), "bar")
예제 #4
0
파일: test_config.py 프로젝트: Phyks/BMC
 def test_get(self):
     config = Config(base_config_path=self.folder)
     self.assertEqual(config.get("proxies"), [''])
예제 #5
0
파일: test_config.py 프로젝트: m000/BMC
 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"))
예제 #6
0
파일: test_config.py 프로젝트: m000/BMC
 def test_set(self):
     config = Config(base_config_path=self.folder)
     config.set("foo", "bar")
     self.assertEqual(config.get("foo"), "bar")
예제 #7
0
파일: test_config.py 프로젝트: m000/BMC
 def test_get(self):
     config = Config(base_config_path=self.folder)
     self.assertEqual(config.get("proxies"), [''])