1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

Mass Rename: CopyOrMove() --> copy_or_move()

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4017
This commit is contained in:
hsoft 2009-06-07 07:15:56 +00:00
parent 750225d27b
commit 57f89183bb
3 changed files with 8 additions and 8 deletions

View File

@ -131,7 +131,7 @@ class DupeGuru(RegistrableApplication):
while files.delete_if_empty(path, ['.DS_Store']): while files.delete_if_empty(path, ['.DS_Store']):
path = path[:-1] path = path[:-1]
def CopyOrMove(self, dupe, copy, destination, dest_type): def copy_or_move(self, dupe, copy, destination, dest_type):
""" """
copy: True = Copy False = Move copy: True = Copy False = Move
destination: string. destination: string.
@ -164,7 +164,7 @@ class DupeGuru(RegistrableApplication):
def do(j): def do(j):
def op(dupe): def op(dupe):
j.add_progress() j.add_progress()
return self.CopyOrMove(dupe, copy, destination, recreate_path) return self.copy_or_move(dupe, copy, destination, recreate_path)
j.start_job(self.results.mark_count) j.start_job(self.results.mark_count)
self.last_op_error_count = self.results.perform_on_marked(op, not copy) self.last_op_error_count = self.results.perform_on_marked(op, not copy)

View File

@ -193,10 +193,10 @@ class DupeGuruPE(app_cocoa.DupeGuru):
iphotolib.update() iphotolib.update()
return result return result
def CopyOrMove(self, dupe, copy, destination, dest_type): def copy_or_move(self, dupe, copy, destination, dest_type):
if isinstance(dupe, IPhoto): if isinstance(dupe, IPhoto):
copy = True copy = True
return app_cocoa.DupeGuru.CopyOrMove(self, dupe, copy, destination, dest_type) return app_cocoa.DupeGuru.copy_or_move(self, dupe, copy, destination, dest_type)
def start_scanning(self): def start_scanning(self):
for directory in self.directories: for directory in self.directories:

View File

@ -57,7 +57,7 @@ class TCDupeGuru(TestCase):
call = app.results.apply_filter.calls[5] call = app.results.apply_filter.calls[5]
self.assertEqual('(abc)', call['filter_str']) self.assertEqual('(abc)', call['filter_str'])
def test_CopyOrMove(self): def test_copy_or_move(self):
# The goal here is just to have a test for a previous blowup I had. I know my test coverage # The goal here is just to have a test for a previous blowup I had. I know my test coverage
# for this unit is pathetic. What's done is done. My approach now is to add tests for # for this unit is pathetic. What's done is done. My approach now is to add tests for
# every change I want to make. The blowup was caused by a missing import. # every change I want to make. The blowup was caused by a missing import.
@ -68,13 +68,13 @@ class TCDupeGuru(TestCase):
self.mock(os, 'makedirs', lambda path: None) # We don't want the test to create that fake directory self.mock(os, 'makedirs', lambda path: None) # We don't want the test to create that fake directory
self.mock(fs.phys, 'Directory', fs.Directory) # We don't want an error because makedirs didn't work self.mock(fs.phys, 'Directory', fs.Directory) # We don't want an error because makedirs didn't work
app = DupeGuru() app = DupeGuru()
app.CopyOrMove(dupe, True, 'some_destination', 0) app.copy_or_move(dupe, True, 'some_destination', 0)
self.assertEqual(1, len(hsutil.files.copy.calls)) self.assertEqual(1, len(hsutil.files.copy.calls))
call = hsutil.files.copy.calls[0] call = hsutil.files.copy.calls[0]
self.assertEqual('some_destination', call['dest_path']) self.assertEqual('some_destination', call['dest_path'])
self.assertEqual(dupe.path, call['source_path']) self.assertEqual(dupe.path, call['source_path'])
def test_CopyOrMove_clean_empty_dirs(self): def test_copy_or_move_clean_empty_dirs(self):
tmppath = Path(self.tmpdir()) tmppath = Path(self.tmpdir())
sourcepath = tmppath + 'source' sourcepath = tmppath + 'source'
io.mkdir(sourcepath) io.mkdir(sourcepath)
@ -83,7 +83,7 @@ class TCDupeGuru(TestCase):
myfile = tmpdir['source']['myfile'] myfile = tmpdir['source']['myfile']
app = DupeGuru() app = DupeGuru()
self.mock(app, 'clean_empty_dirs', log_calls(lambda path: None)) self.mock(app, 'clean_empty_dirs', log_calls(lambda path: None))
app.CopyOrMove(myfile, False, tmppath + 'dest', 0) app.copy_or_move(myfile, False, tmppath + 'dest', 0)
calls = app.clean_empty_dirs.calls calls = app.clean_empty_dirs.calls
self.assertEqual(1, len(calls)) self.assertEqual(1, len(calls))
self.assertEqual(sourcepath, calls[0]['path']) self.assertEqual(sourcepath, calls[0]['path'])