示例#1
0
def test_convert_recipe_parameter_00000083():
    org_file = 'weekcook_web/org/weekcook_00000083.txt'
    org_lines = text_to_strings(org_file)

    wakachi_file = 'weekcook_web/procedure_3/weekcook_00000083_proc3.txt'
    wakachi_string = text_to_strings(wakachi_file)

    json_filepath = 'weekcook_web/ingredient_json/weekcook_00000083.json'
    with open(json_filepath, 'r', encoding='utf-8') as j:
        ingredient_dict = json.load(j)

    num_param_dict = convert_num_to_param(org_lines)
    tool_param_dict = convert_tool_to_param(org_lines)
    unit_param_dict = convert_unit_to_param(wakachi_string, num_param_dict)
    ingredient_param_dict = {'ingredient' + str(idx): v
                             for idx, v in enumerate(ingredient_dict.keys())
                             if v != '材料'}
    convert_strings = convert_cooking_time_wakachi(wakachi_file)
    preordering_wakachi_array = preordering_for_cooking_time_wakachi(
        wakachi_file,
        convert_strings,
    )

    converted_strings, _ = convert_recipe_parameter(
        preordering_wakachi_array,
        ingredient_param_dict,
        num_param_dict,
        unit_param_dict,
        tool_param_dict,
        )
    expected = '<param4>は頭と内臓(腸)を取除いた後、水でよく洗ってからペーパータオルで水気を拭き取る。\n<param7>(<param6>でも可)にサラダ油(分量外)を塗る。\n<param4>に<param5>を振ってから、温めた<param7>(<param6>でも可)に並べ、(<param6>の場合は火が通るまで)焼く。(目安: 約<param1>~<param2><param3>)\n焼き上がった<param4>の<param5>焼きを、お好みで笹を敷いた器に盛り付け、お好みですだちや大根おろしを添えたら完成。\n'
    print('converted_strings', converted_strings)

    assert converted_strings == expected
示例#2
0
def test_convert_tool_to_param_sample():
    sample_file = 'weekcook_web/org/weekcook_sample.txt'
    strings = text_to_strings(sample_file)
    tool_param_dict = convert_tool_to_param(strings)
    print(tool_param_dict)
    expected = {
        'tool1': 'オーブントースター',
    }

    assert tool_param_dict == expected
示例#3
0
def test_convert_tool_to_param_00003159():
    sample_file = 'weekcook_web/org/weekcook_00003159.txt'
    strings = text_to_strings(sample_file)
    tool_param_dict = convert_tool_to_param(strings)
    print(tool_param_dict)
    expected = {
        'tool1': '電子レンジ',
    }

    assert tool_param_dict == expected
示例#4
0
def test_convert_tool_to_param_00001977():
    sample_file = 'weekcook_web/org/weekcook_00001977.txt'
    strings = text_to_strings(sample_file)
    tool_param_dict = convert_tool_to_param(strings)
    print(tool_param_dict)
    expected = {
        'tool1': 'フライパン',
        'tool2': 'グリル',
    }

    assert tool_param_dict == expected