(self)
| 41 | os.remove(temp_name) |
| 42 | |
| 43 | def test_http_storage(self): |
| 44 | storage = HTTPStorage() |
| 45 | url = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/texts/data.txt' |
| 46 | content = 'this is test data' |
| 47 | self.assertEqual(content.encode('utf8'), storage.read(url)) |
| 48 | self.assertEqual(content, storage.read_text(url)) |
| 49 | |
| 50 | with storage.as_local_path(url) as local_file: |
| 51 | with open(local_file, 'r') as infile: |
| 52 | self.assertEqual(content, infile.read()) |
| 53 | |
| 54 | with self.assertRaises(NotImplementedError): |
| 55 | storage.write('dfad', url) |
| 56 | |
| 57 | with self.assertRaises(HTTPError): |
| 58 | storage.read(url + 'df') |
| 59 | |
| 60 | def test_file(self): |
| 61 | url = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/texts/data.txt' |
nothing calls this directly
no test coverage detected