def test_testName(self): color.blue("test here baby") obj = ("hello\n world", ['org', 'ok']) result = assertMy.objToStr(obj) expected = """("hello world", ["org", "ok"])""" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") filename = os.path.dirname(os.path.realpath(__file__)) + "/poligion/poligon.go" position = 56 expected = os.path.dirname(os.path.realpath(__file__)) + "/poligion/Test_doAllForMiByUrl_test.go" if os.path.isfile(expected): os.remove(expected) result = generateTestFileNameForGoTest.createFromPosition(filename, position) testFileContent = filer2.read(result) expectedText = """package elit import ( "my" "testing" ) func Test_doAllForMiByUrl(t *testing.T) { var ( url string expected menuItem t *testing.T ) doAllForMiByUrl(url,expected,t) }""" assertMy.equals(result, expected) assertMy.equals(testFileContent, expectedText)
def test_testName(self): color.blue("test here baby") source = os.path.join(currentFolder, 'filesPoligon/source.iced') target = os.path.join(currentFolder, 'filesPoligon/poligon.iced') result = relativeRequireIced_model.do(target, source) expected = ("poligon = require './poligon.iced'", 'await poligon countryId, regionId, defer result') assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") inputText = "import\n\t\ndef func" result = duplicateLines.remove(inputText) expected = inputText assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") source = os.path.join(currentFolder, 'filesPoligon/source.iced') target = os.path.join(currentFolder, 'filesPoligon/targetEmptyParams.iced') result = relativeRequireIced_model.do(target, source) expected = ("targetEmptyParams = require './targetEmptyParams.iced'", 'await targetEmptyParams defer result') assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") source = "/Users/maks/Dropbox/nodeApps/orad/domain.iced" target = "/Users/maks/Dropbox/nodeApps/orad/test/passByOrgEmailCheck_test.iced" result = absRel3.RelAndCutIfNodeModules(source, target) expected = "./test/passByOrgEmailCheck_test.iced" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") testFolder = "/Users/maks/Library/Application Support/Sublime Text 3/Packages/makeTest/test/poligon" methodName = "myMethod" result = generateTestFileNameForGoTest.createFileNameForGoTest(testFolder, methodName) expected = ("/Users/maks/Library/Application Support/Sublime Text 3/Packages/makeTest/test/poligon/myMethod_test.go", 0) assertMy.equals(result, expected)
def test_testName(self): color.blue("virsion") print(sys.version_info) inputModel = os.path.join(currentFolder, 'filesPoligon/poligon.iced') result = getParams.fileNameToParamString(inputModel) expected = "countryId, regionId" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") result = generateTestFileNameForGoTest.splitArgs("par1 int, par2 string") expected = [{'var': 'par1', 'varType': 'int'}, {'var': 'par2', 'varType': 'string'}] # assert_that(result == expected) assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") fileName="/Users/maks/Library/Application Support/Sublime Text 3/Packages/navigateTo/test/fileNameAndPositionTo_goRunTestCommand/poligon.go" pos = 285 result = navigateToModel.fileNameAndPositionTo_goRunTestCommand(fileName, pos) expected = "go test -test.run Test_toJson" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") sourceFilePath = "/Users/maks/Dropbox/nodeApps/orad/test/sodora.iced" targetFilePath = "/Users/maks/Dropbox/nodeApps/orad/domain.iced" result = absRel3.filePathInsideCurrentProject(sourceFilePath, targetFilePath) expected = True assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") targetFileContent = """th = require 'throw' getCitiesByCountry = require './getCitiesByCountry.iced' regionsByCountryId = require '../../region/regionsByCountryId.iced' citiesByRegionId_slow = require './citiesByRegionId_slow.iced' _ = require 'underscore' module.exports = (db, countryId, autocb)-> await getCitiesByCountry db, countryId, defer result [err, cityList] = result th.err err unless cityList await regionsByCountryId db, countryId, defer result [err, regions] = result th.err err cityList = [] for region in regions await citiesByRegionId_slow db, regionId, defer result [err, cities] = result th.err err cityList = _.union cityList, cities return cityList""" result = returnLast.autocbOneEnding(targetFileContent) expected = "cityList" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") fileContent = """th = require 'throw' th.Throw() assert = require 'assert' module.exports = (input, test)-> th.log "input" th.log input inputModel = require "./#{input}/input.js" th.log "inputModel" th.log inputModel th.log "actual" th.log actual th.log "actual.length" th.log actual.length expected = require "./#{input}/expected.js" actual = JSON.stringify actual expected = JSON.stringify expected assert.deepEqual actual, expected db.fin() test.done()""" result = relativeRequireIced_model.removeRowsStartingFromSpace(fileContent) expected = """th = require 'throw' th.Throw() assert = require 'assert'""" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") filename = os.path.abspath(os.path.join(currentFolder, '../../makeTestForGo/test/createFileName1_test/deep/deep/deep/a.py')) position = 10 testFile = forPy.createFromPosition(filename, position) result = filer.read(testFile) expected = """import unittest import sys sys.path.insert(0, '/Users/maks/Library/Application Support/Sublime Text 3/Packages/util') sys.path.insert(0, '/Users/maks/Library/Application Support/Sublime Text 3/Packages/makeTest/test/createFileName1_test/deep/deep/deep') import color import assertMy import a class Test(unittest.TestCase): def test_testName(self): color.blue("test here baby") result = a.() expected = "" assertMy.equals(result, expected) if __name__ == '__main__': unittest.main()""" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") sourceFileContent = """th = require 'throw' th.Throw() assert = require 'assert' module.exports = (input, test)-> th.log "input" th.log input inputModel = require "./#{input}/input.js" th.log "inputModel" th.log inputModel th.log "actual" th.log actual th.log "actual.length" th.log actual.length expected = require "./#{input}/expected.js" actual = JSON.stringify actual expected = JSON.stringify expected assert.deepEqual actual, expected db.fin() test.done() """ result = relativeRequireIced_model.getPositionInSourceWhereToPaste_bySourceFileContent(sourceFileContent) expected = 58 assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") fileContent = """// Sometimes we'll want to sort a collection by something // other than its natural order. For example, suppose we // wanted to sort strings by their length instead of // alphabetically. Here's an example of custom sorts // in Go. package my import ( "reflect" "testing" "myColors" ) func Test(actual interface{}, expected interface{}, t *testing.T) { myColors.P("actual") myColors.P(actual) myColors.P("expected") myColors.P(expected) eq := reflect.DeepEqual(actual, expected) if !eq { t.Errorf("not equal") } } """ result = generateTestFileNameForGoTest.getPackageName(fileContent) expected = "my" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") (packageName, testMethodName, caller, method, args, returnParams) = ("ordb", "TestRubricById", "org *Org", "GetRubricById", "orgId string, someBool bool", "orgResult *Org, ok bool") result = generateTestFileNameForGoTest.generateTestTextByGoFuncDeclarationParts(packageName, testMethodName, caller, method, args, returnParams) expected = """package ordb import ( "my" "testing" ) func TestRubricById(t *testing.T) { var ( org *Org orgId string someBool bool orgResult *Org ok bool orgResult_expected *Org ok_expected bool ) orgResult,ok = org.GetRubricById(orgId,someBool) expectedJson_orgResult := `` my.FromJson(expectedJson_orgResult, &orgResult_expected) my.Test(orgResult, orgResult_expected, t) expectedJson_ok := `` my.FromJson(expectedJson_ok, &ok_expected) my.Test(ok, ok_expected, t) }""" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") source = os.path.join(currentFolder, 'filesPoligon/source.iced') target = os.path.join(currentFolder, 'filesPoligon/targetSync.iced') result = relativeRequireIced_model.do(target, source) expected = ("targetSync = require './targetSync.iced'", 'actual = targetSync arg1, arg2') assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") text = """// Sometimes we'll want to sort a collection by something // other than its natural order. For example, suppose we // wanted to sort strings by their length instead of // alphabetically. Here's an example of custom sorts // in Go. package elit import ( "encoding/json" ) func Test_toJson(t *testing.T) { actual := toJson(FotoList{ {bigFoto: "1.jpg"}, {bigFoto: "10.jpg"}, }) expected := "" my.Test(actual, expected, t) } """ pos = 287 result = navigateToModel.getMethodNameGo(text, pos) expected = "Test_toJson" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") fileName = "/Users/maks/Library/Application Support/Sublime Text 3/Packages/relative/returnLastString/test/poligon/testFile.iced" result = returnLast.doAllByFileName(fileName) expected = """[err, telIdList] = result th.err err""" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") source = "/Users/maks/Dropbox/nodeApps/orad/domain.iced" target = "/Users/maks/Dropbox/nodeApps/orgi/test/1/html/comment/post/postComment/testing.iced" result = absRel3.RelAndCutIfNodeModules(source, target) expected = "orgi/test/1/html/comment/post/postComment/testing.iced" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") result = generateTestFileNameForGoTest.innerTestFuncPartGoTestPrepare_prepareOneExpectedComparison({"var": "result1", "varType":"int"}) expected = """ expectedJson_result1 := `` my.FromJson(expectedJson_result1, &result1_expected) my.Test(result1, result1_expected, t)""" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") inputText = "for i in\nfor i in" result = duplicateLines.remove(inputText) expected = inputText assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") sourceFilePath = "/Users/maks/Dropbox/nodeApps/orad/test/sodora.iced" targetFilePath = "/Users/maks/Dropbox/nodeApps/redisVgo/rdb/meta/delOrgIdByMeta.iced" result = absRel3.filePathInsideCurrentProject(sourceFilePath, targetFilePath) expected = False assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") source = os.path.join(currentFolder, 'filesPoligon/source.iced') target = os.path.join(currentFolder, 'filesPoligon/targetNoArgs2return.iced') result = relativeRequireIced_model.do(target, source) expected = ("targetNoArgs2return = require './targetNoArgs2return.iced'", '[driver, webdriver] = targetNoArgs2return()') assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") targeFilename = os.path.join(currentFolder, 'filesPoligon/debug/target.iced') sourceFilename = os.path.join(currentFolder, 'filesPoligon/debug/source.iced') result = relativeRequireIced_model.do(targeFilename, sourceFilename) expected = ("target = require './target.iced'", 'await target db, defer cityListWithLongLat') assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") target = "/Users/maks/Library/Application Support/Sublime Text 3/Packages/relative/test/filesPoligon/autocbOnePoligin/target.iced" source = "/Users/maks/Library/Application Support/Sublime Text 3/Packages/relative/test/filesPoligon/autocbOnePoligin/source.iced" result = relativeRequireIced_model.do(target, source) expected = ("target = require './target.iced'", 'await target db, countryId, defer cityList') assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") inputFileName = '/Users/maks/Library/Application Support/Sublime Text 3/Packages/testForNodeJs/test/testPoligon/a/b.iced' expected = inputFileName+'/testing.iced' result = create_test_node_model.getTestingFileName(inputFileName) assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") inputFileName = "/a/b/c/d.iced" fatherFolder = "/a/b" result = create_test_node_model.localFileName(inputFileName, fatherFolder) expected = "c/d.iced" assertMy.equals(result, expected)
def test_testName(self): color.blue("test here baby") filename = os.path.join(currentFolder, 'poligon/example.go') position = 43 result = navigateToModel.fileNameAndPositionTo_goRunTestCommand(filename, position) expectedPath = os.path.join(currentFolder, 'poligon') expected = """cd "{0}"; TALK=1 go test -test.run Test_FromJson0""".format(expectedPath) assertMy.equals(result, expected)