Appending to a table in another file.
(self)
| 6893 | self.assertRaises(KeyError, tbl1.append_where, tbl2, "id > 1") |
| 6894 | |
| 6895 | def test05_otherFile(self): |
| 6896 | """Appending to a table in another file.""" |
| 6897 | |
| 6898 | h5fname2 = tempfile.mktemp(suffix=".h5") |
| 6899 | |
| 6900 | try: |
| 6901 | with tb.open_file(h5fname2, "w") as h5file2: |
| 6902 | tbl1 = self.h5file.root.test |
| 6903 | tbl2 = h5file2.create_table("/", "test", self.SrcTblDesc) |
| 6904 | |
| 6905 | # RW to RW. |
| 6906 | tbl1.append_where(tbl2, "id > 1") |
| 6907 | |
| 6908 | # RW to RO. |
| 6909 | with tb.open_file(h5fname2, "r") as h5file2: |
| 6910 | tbl2 = h5file2.root.test |
| 6911 | self.assertRaises( |
| 6912 | tb.FileModeError, tbl1.append_where, tbl2, "id > 1" |
| 6913 | ) |
| 6914 | |
| 6915 | # RO to RO. |
| 6916 | self._reopen("r") |
| 6917 | tbl1 = self.h5file.root.test |
| 6918 | self.assertRaises( |
| 6919 | tb.FileModeError, tbl1.append_where, tbl2, "id > 1" |
| 6920 | ) |
| 6921 | |
| 6922 | # RO to RW. |
| 6923 | with tb.open_file(h5fname2, "a") as h5file2: |
| 6924 | tbl2 = h5file2.root.test |
| 6925 | tbl1.append_where(tbl2, "id > 1") |
| 6926 | finally: |
| 6927 | if Path(h5fname2).is_file(): |
| 6928 | Path(h5fname2).unlink() |
| 6929 | |
| 6930 | def test06_wholeTable(self): |
| 6931 | """Append whole table.""" |
nothing calls this directly
no test coverage detected