(self)
| 533 | os_helper.unlink(os_helper.TESTFN) |
| 534 | |
| 535 | def test_filewrite(self): |
| 536 | a = array.array(self.typecode, 2*self.example) |
| 537 | f = open(os_helper.TESTFN, 'wb') |
| 538 | try: |
| 539 | f.write(a) |
| 540 | f.close() |
| 541 | b = array.array(self.typecode) |
| 542 | f = open(os_helper.TESTFN, 'rb') |
| 543 | b.fromfile(f, len(self.example)) |
| 544 | self.assertEqual(b, array.array(self.typecode, self.example)) |
| 545 | self.assertNotEqual(a, b) |
| 546 | b.fromfile(f, len(self.example)) |
| 547 | self.assertEqual(a, b) |
| 548 | f.close() |
| 549 | finally: |
| 550 | if not f.closed: |
| 551 | f.close() |
| 552 | os_helper.unlink(os_helper.TESTFN) |
| 553 | |
| 554 | def test_tofromlist(self): |
| 555 | a = array.array(self.typecode, 2*self.example) |
nothing calls this directly
no test coverage detected