tests/readlink.py
author Maciej Fijalkowski <fijall@gmail.com>
Thu, 31 Mar 2016 18:38:08 +0200
changeset 28717 c5f212c8ad78
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
pypy: fix doctests for pypy optimizations PyPy would sometime call __len__ at points where it things preallocating the container makes sense. Change the doctests so they're using generator expressions and not list comprehensions

#!/usr/bin/env python

import errno, os, sys

for f in sys.argv[1:]:
    try:
        print f, '->', os.readlink(f)
    except OSError as err:
        if err.errno != errno.EINVAL:
            raise
        print f, 'not a symlink'

sys.exit(0)