• Victor Stinner's avatar
    Enhance and modernize test_genericpath · e321274b
    Victor Stinner yazdı
    * Replace "try/finally: os.remove()" with self.addCleanup(support.unlink) or
      self.addCleanup(support.rmdir): the support function handles the case when
      the file doesn't exist
    * Replace "try/finally: f.close()" with "with open(...) as f:"
    * test_getsize: add a second test with a different size
    * Create file using "x" mode to ensure that the file didn't exist before, to
      detect bugs in tests
    * Open files in unbuffered mode (buferring=0) to write immediatly data on disk
    * Replace map() with simpler code
    * Split isdir() unit test into two units tests to make them less dependant,
      same change for isfile() test
    * test_samefile(): test also two different files
    e321274b
test_genericpath.py 17.8 KB