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

def test_splice_file_to_pipe(self):

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