MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / assertMode

Method assertMode

tensorboard/manager_test.py:274–290  ·  view source on GitHub ↗

Assert that the permission bits of a file are as expected. Args: path: File to stat. expected: `int`; a subset of 0o777. Raises: AssertionError: If the permissions bits of `path` do not match `expected`.

(self, path, expected)

Source from the content-addressed store, hash-verified

272 return os.listdir(self.info_dir)
273
274 def assertMode(self, path, expected):
275 """Assert that the permission bits of a file are as expected.
276
277 Args:
278 path: File to stat.
279 expected: `int`; a subset of 0o777.
280
281 Raises:
282 AssertionError: If the permissions bits of `path` do not match
283 `expected`.
284 """
285 stat_result = os.stat(path)
286 format_mode = lambda m: "0o%03o" % m
287 self.assertEqual(
288 format_mode(stat_result.st_mode & 0o777),
289 format_mode(expected),
290 )
291
292 def test_fails_if_info_dir_name_is_taken_by_a_regular_file(self):
293 os.rmdir(self.info_dir)

Calls 1

statMethod · 0.45

Tested by

no test coverage detected