'Test `splice` from a pipe to a file'

def test_splice_pipe_to_file(self):

    with NamedTemporaryFile() as fd:
        with pipe() as (pa, pb):
            os.write(pb, 'abcdef')
            res = splice(pa, None, fd, None, 3, 0)
            self.assertEqual(res, (3, None, None))
            self.assertEqual(fd.tell(), 3)
            fd.seek(0, os.SEEK_SET)
            res = splice(pa, None, fd, 3, 3, 0)
            self.assertEqual(res, (3, None, 6))
            self.assertEqual(fd.tell(), 0)
            self.assertEqual(fd.read(6), 'abcdef')
