Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)