def test_fetch_resource(self): wrong_path = casepath('resources/dummy_file.txt') self.assertRaises(XMLSchemaURLError, fetch_resource, wrong_path) right_path = casepath('resources/dummy file.txt') self.assertTrue(fetch_resource(right_path).endswith('dummy file.txt')) ambiguous_path = casepath('resources/dummy file #2.txt') self.assertTrue( fetch_resource(ambiguous_path).endswith('dummy file %232.txt')) res = urlopen(fetch_resource(ambiguous_path)) try: self.assertEqual(res.read(), b'DUMMY CONTENT') finally: res.close()
def test_fetch_resource(self): wrong_path = os.path.join(self.test_dir, 'resources/dummy_file.txt') self.assertRaises(xmlschema.XMLSchemaURLError, xmlschema.fetch_resource, wrong_path) right_path = os.path.join(self.test_dir, 'resources/dummy file.txt') self.assertTrue( xmlschema.fetch_resource(right_path).endswith('y%20file.txt'))
def test_fetch_resource(self): wrong_path = os.path.join(self.test_dir, 'examples/resources/issue017.txt') self.assertRaises(xmlschema.XMLSchemaURLError, xmlschema.fetch_resource, wrong_path) right_path = os.path.join(self.test_dir, 'examples/resources/issue 017.txt') self.assertTrue( xmlschema.fetch_resource(right_path).endswith('e%20017.txt'))
def test_fetch_resource(self): wrong_path = casepath('resources/dummy_file.txt') self.assertRaises(XMLSchemaURLError, fetch_resource, wrong_path) right_path = casepath('resources/dummy file.txt') self.assertTrue(fetch_resource(right_path).endswith('dummy file.txt'))
def test_fetch_resource(self): wrong_path = self.casepath('resources/dummy_file.txt') self.assertRaises(XMLSchemaURLError, fetch_resource, wrong_path) right_path = self.casepath('resources/dummy file.txt') self.assertTrue(fetch_resource(right_path).endswith('dummy file.txt'))