File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,18 @@ class RemoveRootError(OperationFailed):
241241 default_message = "root directory may not be removed"
242242
243243
244+ class IllegalMoveDestination (OperationFailed ):
245+ """Attempt to move a folder into its own subfolder."""
246+
247+ default_message = "'{path}' cannot be moved into itself"
248+
249+
250+ class IllegalCopyDestination (OperationFailed ):
251+ """Attempt to copy a folder into its own subfolder."""
252+
253+ default_message = "'{path}' cannot be copied into itself"
254+
255+
244256class ResourceError (FSError ):
245257 """Base exception class for error associated with a specific resource."""
246258
@@ -304,12 +316,6 @@ class DirectoryNotEmpty(ResourceError):
304316 default_message = "directory '{path}' is not empty"
305317
306318
307- class InvalidMoveOperation (ResourceError ):
308- """Attempt to move a folder into its own subfolder."""
309-
310- default_message = "you cannot move '{path}' into its own subfolder"
311-
312-
313319class ResourceLocked (ResourceError ):
314320 """Attempt to use a locked resource."""
315321
Original file line number Diff line number Diff line change @@ -1924,7 +1924,7 @@ def test_movedir_into_its_own_subfolder(self):
19241924 sub = folder .makedir ("sub" )
19251925 sub .writetext ("file2.txt" , "Hello2" )
19261926
1927- with self .assertRaises (errors .InvalidMoveOperation ):
1927+ with self .assertRaises (errors .IllegalMoveDestination ):
19281928 self .fs .movedir ("folder" , "folder/sub/" )
19291929
19301930 def test_match (self ):
You can’t perform that action at this time.
0 commit comments