def convert_rnc(filename): import rnc2rng filename_root, _ = os.path.splitext(filename) with open(filename, 'r') as rnc: root = rnc2rng.load(rnc) with open(filename_root + '.rng', 'w') as rng: rnc2rng.dump(root, rng)
def convert_rnc(): import rnc2rng filename_root, _ = os.path.splitext(CSL_SCHEMA_RNC) root = rnc2rng.load(CSL_SCHEMA_RNC) with io.open(filename_root + '.rng', 'w', encoding='utf-8') as rng: rnc2rng.dump(root, rng)
def runTest(self): root = rnc2rng.load(self.fn) with open(self.fn.replace('.rnc', '.rng')) as f: expected = f.read().rstrip() actual = rnc2rng.dumps(root).strip() self.assertBestEqual(expected, actual)
def runTest(self): with open(self.fn) as f: root = rnc2rng.load(f) with open(self.fn.replace('.rnc', '.rng')) as f: expected = f.read().rstrip() actual = rnc2rng.dumps(root).strip() self.assertBestEqual(expected, actual)
def runTest(self): root = rnc2rng.load(self.fn) ref = self.fn.replace('.rnc', '.rng') ref = ref[7:] if ref.startswith('file://') else ref with open(ref) as f: expected = f.read().rstrip() actual = rnc2rng.dumps(root).strip() self.assertBestEqual(expected, actual)