def test_testName(self): color.blue("test here baby") inputText = """if inlist: print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') color.red('inlist') print(inlist) print('*****************************************************************') currentIndex = allList.index(current) #todo: make test to test when current item not in list chooseNumber = currentIndex + 1 if chooseNumber >= len(allList):""" filename = os.path.join(currentFolder, 'files/printColor.poligon') filer.write(filename, inputText) clear.pyFile(filename) result = filer.read(filename) expected = """if inlist: currentIndex = allList.index(current) #todo: make test to test when current item not in list chooseNumber = currentIndex + 1 if chooseNumber >= len(allList):""" print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') color.red('expected') print(expected) print('*****************************************************************') self.assertEqual(result, expected)
def test_testName(self): color.blue("test here baby") inputText = """import sublime import sublime_plugin import os from os import listdir from os.path import isfile, join import sys sys.path.insert(0, '/Users/maks/Library/Application Support/Sublime Text 3/Packages/goodPath') import findAllRelative_model class repaire_relative_paths_plugin_Command(sublime_plugin.WindowCommand): def run(self): print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') print("new run repaire_relative_paths_plugin_") print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') window = self.window view = window.active_view() filename = view.file_name() findAllRelative_model.goAndWrite(filename) sublime.status_message("repaire_relative_paths_plugin done") """ filename = os.path.join(currentFolder, 'files/printColor.poligon') filer.write(filename, inputText) clear.pyFile(filename) result = filer.read(filename) color.red('result') print(repr(result)) expected = """import sublime import sublime_plugin import os from os import listdir from os.path import isfile, join import sys sys.path.insert(0, '/Users/maks/Library/Application Support/Sublime Text 3/Packages/goodPath') import findAllRelative_model class repaire_relative_paths_plugin_Command(sublime_plugin.WindowCommand): def run(self): window = self.window view = window.active_view() filename = view.file_name() findAllRelative_model.goAndWrite(filename) sublime.status_message("repaire_relative_paths_plugin done")""" color.red('expected') print(expected) assertMy.stringDiffByLines(result, expected )
def run(self): view = self.window.active_view() filename = view.file_name() clearModel.pyFile(filename) beatyModel.pyFileFull(filename)