def test_zero_padding1(self):
     file = FileManagement()
     file.name = '1A'
     file.zero_padding()
     self.assertEqual(file.name, '001A.py')
Beispiel #2
0
import os
import shutil
from paths import path_abc  # 同フォルダに必要なパスが書かれたファイルを用意
from file_management import FileManagement

for foldername, subfolders, filenames in os.walk(path_abc):
    for filename in filenames:
        file = FileManagement()
        file.path = foldername + '\\' + filename
        file.name = filename
        file.zero_padding()
        '''
        shutil.move(hoge, fuga)はファイルやフォルダに対し移動及び名前の変更をするため、
        print(hoge, fuga)で大丈夫なことを必ず確認した後にコメントアウトを消し、実行する
        '''
        # shutil.move(file.path, foldername + '\\' + file.name)
        print(file.path, foldername + '\\' + file.name)
 def test_zero_padding7(self):
     file = FileManagement()
     file.name = 'E'
     file.zero_padding()
     self.assertEqual(file.name, 'E.py')
 def test_zero_padding6(self):
     file = FileManagement()
     file.name = '100D'
     file.zero_padding()
     self.assertEqual(file.name, '100D.py')
 def test_zero_padding5(self):
     file = FileManagement()
     file.name = '99F'
     file.zero_padding()
     self.assertEqual(file.name, '099F.py')
 def test_zero_padding3(self):
     file = FileManagement()
     file.name = '3AC'
     file.zero_padding()
     self.assertEqual(file.name, '3AC.py')
 def test_zero_padding2(self):
     file = FileManagement()
     file.name = '02B'
     file.zero_padding()
     self.assertEqual(file.name, '02B.py')