def readGeneral(): data = fileIO.readJSON(CONFIG_G) author = data["author"] mod_name = data["mod-name"] input_file = data["input-file"] output_file = data["output-file"] return author, mod_name, input_file, output_file
def readConfig(): data = fileIO.readJSON(CONFIG) author = data["author"] namespace = data["namespace"] name_from_ingredient = data["name-from-ingredient"] recipes = data["recipes"] implementations = data["implementations"] return author, namespace, name_from_ingredient, recipes, implementations
def test_readJSON(): testDictionary = { "myInt": 1234, "myString": "1234", "myFloat": 12.34, "myBool": True } assert (fileIO.readJSON(THISDIR + "/testFileIO.json") == testDictionary)
def test_getAllImplementationsShapeless(): builder.IMPLEMENTATIONS = [{ "usesid": "test1", "ingredients": [["thisIsA:result", ["thisIsA:notherIngredient"]]] }] builder.getAllImplementations() assert (fileIO.readJSON(THISDIR + "/result_from_notherIngredient.json") ["group"] == "thisIsA:test_group1")
def readBlocksAndItems(): data = fileIO.readJSON(CONFIG_B) ''' eg. resources = [ [[res1, res2, res3], [ore, block, bricks, tools]], [[res4], [ore, tools]]] ''' resources = data["resources"] blocks = data["blocks"] items = data["items"] return resources, blocks, items
def test_getAllImplementationsPattern(): builder.IMPLEMENTATIONS = [{ "usesid": "test0", "ingredients": [["thisIsA:result", ["thisIsA:ingredient"]]] }] builder.getAllImplementations() assert (fileIO.readJSON(THISDIR + "/result_from_ingredient.json")["pattern"] == [ "A ", " A ", " A" ])
def test_assembleRecipeShapeless(): builder.assembleRecipe( "shapeless", { "id": "test1", "shapeless": ["A", "B"], "predef_ingredients": [{ "A": "thisIsA:ingredient" }], "group": "test_group1", "count": 1 }, "thisIsA:result", ["thisIsA:notherIngredient"]) assert (fileIO.readJSON(THISDIR + "/result_from_notherIngredient.json") ["group"] == "thisIsA:test_group1")
def test_assembleRecipePattern(): builder.assembleRecipe( "pattern", { "id": "test0", "pattern": ["A ", " A ", " A"], "predef_ingredients": [], "group": "test_group0", "count": 1 }, "thisIsA:result", ["thisIsA:ingredient"]) assert (fileIO.readJSON(THISDIR + "/result_from_ingredient.json")["pattern"] == [ "A ", " A ", " A" ])
def readGenerateMethods(): data = fileIO.readJSON(CONFIG_M) lib = data["generate-java-lib"] registers = data["generate-java-registers"] main = data["generate-java-main-files"] return lib, registers, main
def readConfig(): data = fileIO.readJSON(fileIO.genFileName([THISDIR, CONFIG])) return data["minLength"], data["weakSymbols"], data["weakNumbers"], data[ "suggestions"], data["minLengthRes"], data["maxLengthRes"], data[ "entropy"]