def test_is_image_file(self): assert fs.is_image_file('/trash/well.jpg') assert fs.is_image_file('/trash/well.jpeg') assert fs.is_image_file('/trash/well.png') assert fs.is_image_file('/trash/well.gif') assert fs.is_image_file('/trash/well.JPG') assert fs.is_image_file('/trash/well.PNG') # assert not fs.is_image_file('/trash/well.txt') assert not fs.is_image_file('/trash/well.py') assert not fs.is_image_file('/trash/well.java')
def check(path): if not fs.is_image_file(path): print >>sys.stderr, "Error: provide an _image_ file." sys.exit(1) # if fs.is_local_path(path) and not os.path.isfile(path): print >>sys.stderr, "Error: the input file doesn't exist." sys.exit(1)