code
stringlengths 26
870k
| docstring
stringlengths 1
65.6k
| func_name
stringlengths 1
194
| language
stringclasses 1
value | repo
stringlengths 8
68
| path
stringlengths 5
194
| url
stringlengths 46
254
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
def test_moveToExistsCacheCrossMount(self):
"""
The assertion of test_moveToExistsCache should hold in the case of a
cross-mount move.
"""
self.setUpFaultyRename()
self.test_moveToExistsCache() | The assertion of test_moveToExistsCache should hold in the case of a
cross-mount move. | test_moveToExistsCacheCrossMount | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_moveToSizeCache(self, hook=lambda : None):
"""
L{FilePath.moveTo} clears its destination's status cache, such that
calls to L{FilePath.getsize} after the call to C{moveTo} will report the
new size, not the old one.
This is a separate test from C{test_moveToExistsCache} because it is
intended to cover the fact that the destination's cache is dropped;
test_moveToExistsCache doesn't cover this case because (currently) a
file that doesn't exist yet does not cache the fact of its non-
existence.
"""
fp = filepath.FilePath(self.mktemp())
fp2 = filepath.FilePath(self.mktemp())
fp.setContent(b"1234")
fp2.setContent(b"1234567890")
hook()
# Sanity check / kick off caching.
self.assertEqual(fp.getsize(), 4)
self.assertEqual(fp2.getsize(), 10)
# Actually attempting to replace a file on Windows would fail with
# ERROR_ALREADY_EXISTS, but we don't need to test that, just the cached
# metadata, so, delete the file ...
os.remove(fp2.path)
# ... but don't clear the status cache, as fp2.remove() would.
self.assertEqual(fp2.getsize(), 10)
fp.moveTo(fp2)
self.assertEqual(fp2.getsize(), 4) | L{FilePath.moveTo} clears its destination's status cache, such that
calls to L{FilePath.getsize} after the call to C{moveTo} will report the
new size, not the old one.
This is a separate test from C{test_moveToExistsCache} because it is
intended to cover the fact that the destination's cache is dropped;
test_moveToExistsCache doesn't cover this case because (currently) a
file that doesn't exist yet does not cache the fact of its non-
existence. | test_moveToSizeCache | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_moveToSizeCacheCrossMount(self):
"""
The assertion of test_moveToSizeCache should hold in the case of a
cross-mount move.
"""
self.test_moveToSizeCache(hook=self.setUpFaultyRename) | The assertion of test_moveToSizeCache should hold in the case of a
cross-mount move. | test_moveToSizeCacheCrossMount | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_moveToError(self):
"""
Verify error behavior of moveTo: it should raises one of OSError or
IOError if you want to move a path into one of its child. It's simply
the error raised by the underlying rename system call.
"""
self.assertRaises((OSError, IOError), self.path.moveTo, self.path.child(b'file1')) | Verify error behavior of moveTo: it should raises one of OSError or
IOError if you want to move a path into one of its child. It's simply
the error raised by the underlying rename system call. | test_moveToError | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def setUpFaultyRename(self):
"""
Set up a C{os.rename} that will fail with L{errno.EXDEV} on first call.
This is used to simulate a cross-device rename failure.
@return: a list of pair (src, dest) of calls to C{os.rename}
@rtype: C{list} of C{tuple}
"""
invokedWith = []
def faultyRename(src, dest):
invokedWith.append((src, dest))
if len(invokedWith) == 1:
raise OSError(errno.EXDEV, 'Test-induced failure simulating '
'cross-device rename failure')
return originalRename(src, dest)
originalRename = os.rename
self.patch(os, "rename", faultyRename)
return invokedWith | Set up a C{os.rename} that will fail with L{errno.EXDEV} on first call.
This is used to simulate a cross-device rename failure.
@return: a list of pair (src, dest) of calls to C{os.rename}
@rtype: C{list} of C{tuple} | setUpFaultyRename | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_crossMountMoveTo(self):
"""
C{moveTo} should be able to handle C{EXDEV} error raised by
C{os.rename} when trying to move a file on a different mounted
filesystem.
"""
invokedWith = self.setUpFaultyRename()
# Bit of a whitebox test - force os.rename, which moveTo tries
# before falling back to a slower method, to fail, forcing moveTo to
# use the slower behavior.
self.test_moveTo()
# A bit of a sanity check for this whitebox test - if our rename
# was never invoked, the test has probably fallen into disrepair!
self.assertTrue(invokedWith) | C{moveTo} should be able to handle C{EXDEV} error raised by
C{os.rename} when trying to move a file on a different mounted
filesystem. | test_crossMountMoveTo | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_crossMountMoveToWithSymlink(self):
"""
By default, when moving a symlink, it should follow the link and
actually copy the content of the linked node.
"""
invokedWith = self.setUpFaultyRename()
f2 = self.path.child(b'file2')
f3 = self.path.child(b'file3')
self.symlink(self.path.child(b'file1').path, f2.path)
f2.moveTo(f3)
self.assertFalse(f3.islink())
self.assertEqual(f3.getContent(), b'file 1')
self.assertTrue(invokedWith) | By default, when moving a symlink, it should follow the link and
actually copy the content of the linked node. | test_crossMountMoveToWithSymlink | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_crossMountMoveToWithoutSymlink(self):
"""
Verify that moveTo called with followLinks=False actually create
another symlink.
"""
invokedWith = self.setUpFaultyRename()
f2 = self.path.child(b'file2')
f3 = self.path.child(b'file3')
self.symlink(self.path.child(b'file1').path, f2.path)
f2.moveTo(f3, followLinks=False)
self.assertTrue(f3.islink())
self.assertEqual(f3.getContent(), b'file 1')
self.assertTrue(invokedWith) | Verify that moveTo called with followLinks=False actually create
another symlink. | test_crossMountMoveToWithoutSymlink | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_createBinaryMode(self):
"""
L{FilePath.create} should always open (and write to) files in binary
mode; line-feed octets should be unmodified.
(While this test should pass on all platforms, it is only really
interesting on platforms which have the concept of binary mode, i.e.
Windows platforms.)
"""
path = filepath.FilePath(self.mktemp())
with path.create() as f:
self.assertIn("b", f.mode)
f.write(b"\n")
with open(path.path, "rb") as fp:
read = fp.read()
self.assertEqual(read, b"\n") | L{FilePath.create} should always open (and write to) files in binary
mode; line-feed octets should be unmodified.
(While this test should pass on all platforms, it is only really
interesting on platforms which have the concept of binary mode, i.e.
Windows platforms.) | test_createBinaryMode | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_openWithExplicitBinaryMode(self):
"""
Due to a bug in Python 2.7 on Windows including multiple 'b'
characters in the mode passed to the built-in open() will cause an
error. FilePath.open() ensures that only a single 'b' character is
included in the mode passed to the built-in open().
See http://bugs.python.org/issue7686 for details about the bug.
"""
writer = self.path.child(b'explicit-binary')
with writer.open('wb') as file:
file.write(b'abc\ndef')
self.assertTrue(writer.exists) | Due to a bug in Python 2.7 on Windows including multiple 'b'
characters in the mode passed to the built-in open() will cause an
error. FilePath.open() ensures that only a single 'b' character is
included in the mode passed to the built-in open().
See http://bugs.python.org/issue7686 for details about the bug. | test_openWithExplicitBinaryMode | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_openWithRedundantExplicitBinaryModes(self):
"""
Due to a bug in Python 2.7 on Windows including multiple 'b'
characters in the mode passed to the built-in open() will cause an
error. No matter how many 'b' modes are specified, FilePath.open()
ensures that only a single 'b' character is included in the mode
passed to the built-in open().
See http://bugs.python.org/issue7686 for details about the bug.
"""
writer = self.path.child(b'multiple-binary')
with writer.open('wbb') as file:
file.write(b'abc\ndef')
self.assertTrue(writer.exists) | Due to a bug in Python 2.7 on Windows including multiple 'b'
characters in the mode passed to the built-in open() will cause an
error. No matter how many 'b' modes are specified, FilePath.open()
ensures that only a single 'b' character is included in the mode
passed to the built-in open().
See http://bugs.python.org/issue7686 for details about the bug. | test_openWithRedundantExplicitBinaryModes | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_existsCache(self):
"""
Check that C{filepath.FilePath.exists} correctly restat the object if
an operation has occurred in the mean time.
"""
fp = filepath.FilePath(self.mktemp())
self.assertFalse(fp.exists())
fp.makedirs()
self.assertTrue(fp.exists()) | Check that C{filepath.FilePath.exists} correctly restat the object if
an operation has occurred in the mean time. | test_existsCache | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_makedirsMakesDirectoriesRecursively(self):
"""
C{FilePath.makedirs} creates a directory at C{path}}, including
recursively creating all parent directories leading up to the path.
"""
fp = filepath.FilePath(os.path.join(
self.mktemp(), b"foo", b"bar", b"baz"))
self.assertFalse(fp.exists())
fp.makedirs()
self.assertTrue(fp.exists())
self.assertTrue(fp.isdir()) | C{FilePath.makedirs} creates a directory at C{path}}, including
recursively creating all parent directories leading up to the path. | test_makedirsMakesDirectoriesRecursively | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_makedirsMakesDirectoriesWithIgnoreExistingDirectory(self):
"""
Calling C{FilePath.makedirs} with C{ignoreExistingDirectory} set to
C{True} has no effect if directory does not exist.
"""
fp = filepath.FilePath(self.mktemp())
self.assertFalse(fp.exists())
fp.makedirs(ignoreExistingDirectory=True)
self.assertTrue(fp.exists())
self.assertTrue(fp.isdir()) | Calling C{FilePath.makedirs} with C{ignoreExistingDirectory} set to
C{True} has no effect if directory does not exist. | test_makedirsMakesDirectoriesWithIgnoreExistingDirectory | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_makedirsThrowsWithExistentDirectory(self):
"""
C{FilePath.makedirs} throws an C{OSError} exception
when called on a directory that already exists.
"""
fp = filepath.FilePath(os.path.join(self.mktemp()))
fp.makedirs()
exception = self.assertRaises(OSError, fp.makedirs)
self.assertEqual(exception.errno, errno.EEXIST) | C{FilePath.makedirs} throws an C{OSError} exception
when called on a directory that already exists. | test_makedirsThrowsWithExistentDirectory | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_makedirsAcceptsIgnoreExistingDirectory(self):
"""
C{FilePath.makedirs} succeeds when called on a directory that already
exists and the c{ignoreExistingDirectory} argument is set to C{True}.
"""
fp = filepath.FilePath(self.mktemp())
fp.makedirs()
self.assertTrue(fp.exists())
fp.makedirs(ignoreExistingDirectory=True)
self.assertTrue(fp.exists()) | C{FilePath.makedirs} succeeds when called on a directory that already
exists and the c{ignoreExistingDirectory} argument is set to C{True}. | test_makedirsAcceptsIgnoreExistingDirectory | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_makedirsIgnoreExistingDirectoryExistAlreadyAFile(self):
"""
When C{FilePath.makedirs} is called with C{ignoreExistingDirectory} set
to C{True} it throws an C{OSError} exceptions if path is a file.
"""
fp = filepath.FilePath(self.mktemp())
fp.create()
self.assertTrue(fp.isfile())
exception = self.assertRaises(
OSError, fp.makedirs, ignoreExistingDirectory=True)
self.assertEqual(exception.errno, errno.EEXIST) | When C{FilePath.makedirs} is called with C{ignoreExistingDirectory} set
to C{True} it throws an C{OSError} exceptions if path is a file. | test_makedirsIgnoreExistingDirectoryExistAlreadyAFile | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_makedirsRaisesNonEexistErrorsIgnoreExistingDirectory(self):
"""
When C{FilePath.makedirs} is called with C{ignoreExistingDirectory} set
to C{True} it raises an C{OSError} exception if exception errno is not
EEXIST.
"""
def faultyMakedirs(path):
raise OSError(errno.EACCES, 'Permission Denied')
self.patch(os, 'makedirs', faultyMakedirs)
fp = filepath.FilePath(self.mktemp())
exception = self.assertRaises(
OSError, fp.makedirs, ignoreExistingDirectory=True)
self.assertEqual(exception.errno, errno.EACCES) | When C{FilePath.makedirs} is called with C{ignoreExistingDirectory} set
to C{True} it raises an C{OSError} exception if exception errno is not
EEXIST. | test_makedirsRaisesNonEexistErrorsIgnoreExistingDirectory | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_changed(self):
"""
L{FilePath.changed} indicates that the L{FilePath} has changed, but does
not re-read the status information from the filesystem until it is
queried again via another method, such as C{getsize}.
"""
fp = filepath.FilePath(self.mktemp())
fp.setContent(b"12345")
self.assertEqual(fp.getsize(), 5)
# Someone else comes along and changes the file.
with open(fp.path, 'wb') as fObj:
fObj.write(b"12345678")
# Sanity check for caching: size should still be 5.
self.assertEqual(fp.getsize(), 5)
fp.changed()
# This path should look like we don't know what status it's in, not that
# we know that it didn't exist when last we checked.
self.assertIsNone(fp.statinfo)
self.assertEqual(fp.getsize(), 8) | L{FilePath.changed} indicates that the L{FilePath} has changed, but does
not re-read the status information from the filesystem until it is
queried again via another method, such as C{getsize}. | test_changed | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_getPermissions_POSIX(self):
"""
Getting permissions for a file returns a L{Permissions} object for
POSIX platforms (which supports separate user, group, and other
permissions bits.
"""
for mode in (0o777, 0o700):
self.path.child(b"sub1").chmod(mode)
self.assertEqual(self.path.child(b"sub1").getPermissions(),
filepath.Permissions(mode))
self.path.child(b"sub1").chmod(0o764) #sanity check
self.assertEqual(
self.path.child(b"sub1").getPermissions().shorthand(),
"rwxrw-r--") | Getting permissions for a file returns a L{Permissions} object for
POSIX platforms (which supports separate user, group, and other
permissions bits. | test_getPermissions_POSIX | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_deprecateStatinfoGetter(self):
"""
Getting L{twisted.python.filepath.FilePath.statinfo} is deprecated.
"""
fp = filepath.FilePath(self.mktemp())
fp.statinfo
warningInfo = self.flushWarnings([self.test_deprecateStatinfoGetter])
self.assertEqual(len(warningInfo), 1)
self.assertEqual(warningInfo[0]['category'], DeprecationWarning)
self.assertEqual(
warningInfo[0]['message'],
"twisted.python.filepath.FilePath.statinfo was deprecated in "
"Twisted 15.0.0; please use other FilePath methods such as "
"getsize(), isdir(), getModificationTime(), etc. instead") | Getting L{twisted.python.filepath.FilePath.statinfo} is deprecated. | test_deprecateStatinfoGetter | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_deprecateStatinfoSetter(self):
"""
Setting L{twisted.python.filepath.FilePath.statinfo} is deprecated.
"""
fp = filepath.FilePath(self.mktemp())
fp.statinfo = None
warningInfo = self.flushWarnings([self.test_deprecateStatinfoSetter])
self.assertEqual(len(warningInfo), 1)
self.assertEqual(warningInfo[0]['category'], DeprecationWarning)
self.assertEqual(
warningInfo[0]['message'],
"twisted.python.filepath.FilePath.statinfo was deprecated in "
"Twisted 15.0.0; please use other FilePath methods such as "
"getsize(), isdir(), getModificationTime(), etc. instead") | Setting L{twisted.python.filepath.FilePath.statinfo} is deprecated. | test_deprecateStatinfoSetter | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_deprecateStatinfoSetterSets(self):
"""
Setting L{twisted.python.filepath.FilePath.statinfo} changes the value
of _statinfo such that getting statinfo again returns the new value.
"""
fp = filepath.FilePath(self.mktemp())
fp.statinfo = None
self.assertIsNone(fp.statinfo) | Setting L{twisted.python.filepath.FilePath.statinfo} changes the value
of _statinfo such that getting statinfo again returns the new value. | test_deprecateStatinfoSetterSets | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_filePathNotDeprecated(self):
"""
While accessing L{twisted.python.filepath.FilePath.statinfo} is
deprecated, the filepath itself is not.
"""
filepath.FilePath(self.mktemp())
warningInfo = self.flushWarnings([self.test_filePathNotDeprecated])
self.assertEqual(warningInfo, []) | While accessing L{twisted.python.filepath.FilePath.statinfo} is
deprecated, the filepath itself is not. | test_filePathNotDeprecated | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_getPermissions_Windows(self):
"""
Getting permissions for a file returns a L{Permissions} object in
Windows. Windows requires a different test, because user permissions
= group permissions = other permissions. Also, chmod may not be able
to set the execute bit, so we are skipping tests that set the execute
bit.
"""
# Change permission after test so file can be deleted
self.addCleanup(self.path.child(b"sub1").chmod, 0o777)
for mode in (0o777, 0o555):
self.path.child(b"sub1").chmod(mode)
self.assertEqual(self.path.child(b"sub1").getPermissions(),
filepath.Permissions(mode))
self.path.child(b"sub1").chmod(0o511) #sanity check to make sure that
# user=group=other permissions
self.assertEqual(self.path.child(b"sub1").getPermissions().shorthand(),
"r-xr-xr-x") | Getting permissions for a file returns a L{Permissions} object in
Windows. Windows requires a different test, because user permissions
= group permissions = other permissions. Also, chmod may not be able
to set the execute bit, so we are skipping tests that set the execute
bit. | test_getPermissions_Windows | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_whetherBlockOrSocket(self):
"""
Ensure that a file is not a block or socket
"""
self.assertFalse(self.path.isBlockDevice())
self.assertFalse(self.path.isSocket()) | Ensure that a file is not a block or socket | test_whetherBlockOrSocket | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_statinfoBitsNotImplementedInWindows(self):
"""
Verify that certain file stats are not available on Windows
"""
self.assertRaises(NotImplementedError, self.path.getInodeNumber)
self.assertRaises(NotImplementedError, self.path.getDevice)
self.assertRaises(NotImplementedError, self.path.getNumberOfHardLinks)
self.assertRaises(NotImplementedError, self.path.getUserID)
self.assertRaises(NotImplementedError, self.path.getGroupID) | Verify that certain file stats are not available on Windows | test_statinfoBitsNotImplementedInWindows | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
def test_statinfoBitsAreNumbers(self):
"""
Verify that file inode/device/nlinks/uid/gid stats are numbers in
a POSIX environment
"""
numbers = (int, long)
c = self.path.child(b'file1')
for p in self.path, c:
self.assertIsInstance(p.getInodeNumber(), numbers)
self.assertIsInstance(p.getDevice(), numbers)
self.assertIsInstance(p.getNumberOfHardLinks(), numbers)
self.assertIsInstance(p.getUserID(), numbers)
self.assertIsInstance(p.getGroupID(), numbers)
self.assertEqual(self.path.getUserID(), c.getUserID())
self.assertEqual(self.path.getGroupID(), c.getGroupID()) | Verify that file inode/device/nlinks/uid/gid stats are numbers in
a POSIX environment | test_statinfoBitsAreNumbers | python | wistbean/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | https://github.com/wistbean/learn_python3_spider/blob/master/stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py | MIT |
Subsets and Splits