Esempio n. 1
0
 def _(*args, **kwargs):
     if exception:
         raise {
             "KeyError": KeyError,
             "OSError": OSError,
         }[exception]()
     return {
         "stat": lambda x: stat_result(*x),
         "lstat": lambda x: stat_result(*x),
         "getgrall": lambda x: [struct_group(*y) for y in x],
         "getgrnam": lambda x: struct_group(*x),
         "getgrgid": lambda x: struct_group(*x),
         "getpwall": lambda x: [struct_passwd(*y) for y in x],
         "getpwnam": lambda x: struct_passwd(*x),
         "getpwuid": lambda x: struct_passwd(*x),
         "getspall": lambda x: [struct_spwd(*y) for y in x],
         "getspnam": lambda x: struct_spwd(*x),
     }.get(f, lambda x: x)(results)
Esempio n. 2
0
 def _(*args, **kwargs):
     if exception:
         raise {
             "KeyError": KeyError,
             "OSError": OSError,
         }[exception]()
     return {
         "stat": lambda x: stat_result(*x),
         "lstat": lambda x: stat_result(*x),
         "getgrall": lambda x: [struct_group(*y) for y in x],
         "getgrnam": lambda x: struct_group(*x),
         "getgrgid": lambda x: struct_group(*x),
         "getpwall": lambda x: [struct_passwd(*y) for y in x],
         "getpwnam": lambda x: struct_passwd(*x),
         "getpwuid": lambda x: struct_passwd(*x),
         "getspall": lambda x: [struct_spwd(*y) for y in x],
         "getspnam": lambda x: struct_spwd(*x),
     }.get(f, lambda x: x)(results)
Esempio n. 3
0
 def test_lstat(self):
     self.os.lstat.return_value = stat_result(0o755, 0, 0, 0, 0, 0, 0, 0, 0,
                                              0)
     self.assertEqual(self.transport.lstat("/").st_mode, 0o755)
     self.os.lstat.assert_called_with("/")
 def test_lstat(self):
     self.os.lstat.return_value = stat_result(
         0o755, 0, 0, 0, 0, 0, 0, 0, 0, 0)
     self.assertEqual(self.transport.lstat("/").st_mode, 0o755)
     self.os.lstat.assert_called_with("/")