test_fileutils.py 502 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. from boltons.fileutils import FilePerms
  3. def test_fileperms():
  4. up = FilePerms()
  5. up.other = ''
  6. up.user = 'xrw'
  7. up.group = 'rrrwx'
  8. try:
  9. up.other = 'nope'
  10. except ValueError:
  11. # correctly raised ValueError on invalid chars
  12. pass
  13. assert repr(up) == "FilePerms(user='rwx', group='rwx', other='')"
  14. assert up.user == 'rwx'
  15. assert oct(int(up)).endswith('770') # 0770 on py2 and 0o770 on py3
  16. assert int(FilePerms()) == 0