(self, fopen, suffixes)
| 639 | |
| 640 | class LoadTxtBase: |
| 641 | def check_compressed(self, fopen, suffixes): |
| 642 | # Test that we can load data from a compressed file |
| 643 | wanted = np.arange(6).reshape((2, 3)) |
| 644 | linesep = ('\n', '\r\n', '\r') |
| 645 | for sep in linesep: |
| 646 | data = '0 1 2' + sep + '3 4 5' |
| 647 | for suffix in suffixes: |
| 648 | with temppath(suffix=suffix) as name: |
| 649 | with fopen(name, mode='wt', encoding='UTF-32-LE') as f: |
| 650 | f.write(data) |
| 651 | res = self.loadfunc(name, encoding='UTF-32-LE') |
| 652 | assert_array_equal(res, wanted) |
| 653 | with fopen(name, "rt", encoding='UTF-32-LE') as f: |
| 654 | res = self.loadfunc(f) |
| 655 | assert_array_equal(res, wanted) |
| 656 | |
| 657 | def test_compressed_gzip(self): |
| 658 | self.check_compressed(gzip.open, ('.gz',)) |
no test coverage detected