Exemple #1
0
    def test_readXYwriteXY_from_open_file_binary_mode(self):
        """
        Reading/writing XY sac files to open files in binary mode.
        """
        # Original.
        st = _read_sacXY(self.filexy)

        with NamedTemporaryFile() as tf:
            _write_sacXY(st, tf)
            tf.seek(0, 0)
            st2 = _read_sacXY(tf)

        self.assertEqual(st, st2)
Exemple #2
0
    def test_readXYwriteXY_from_open_file_binary_mode(self):
        """
        Reading/writing XY sac files to open files in binary mode.
        """
        # Original.
        st = _read_sacXY(self.filexy)

        with NamedTemporaryFile() as tf:
            _write_sacXY(st, tf)
            tf.seek(0, 0)
            st2 = _read_sacXY(tf)

        self.assertEqual(st, st2)
Exemple #3
0
    def test_readXYwriteXY_from_BytesIO(self):
        """
        Reading/writing XY sac files from/to io.BytesIO. It's alphanumeric
        so bytes should also do the trick.
        """
        # Original.
        st = _read_sacXY(self.filexy)

        with io.BytesIO() as fh:
            _write_sacXY(st, fh)
            fh.seek(0, 0)
            st2 = _read_sacXY(fh)

        self.assertEqual(st, st2)
Exemple #4
0
    def test_readXYwriteXY_from_BytesIO(self):
        """
        Reading/writing XY sac files from/to io.BytesIO. It's alphanumeric
        so bytes should also do the trick.
        """
        # Original.
        st = _read_sacXY(self.filexy)

        with io.BytesIO() as fh:
            _write_sacXY(st, fh)
            fh.seek(0, 0)
            st2 = _read_sacXY(fh)

        self.assertEqual(st, st2)