Exemplo n.º 1
0
def baosteel_certificate_pdf_sample_vl_a():
    test_file_vl_a = 'J0E0061697_BGSAJ2009120012700.pdf'
    abs_path = os.path.abspath(test_file_vl_a)
    if os.path.exists(test_file_vl_a):
        os.remove(test_file_vl_a)
    file_source = os.path.abspath(r"../test_data")
    shutil.copy(os.path.join(file_source, test_file_vl_a), test_file_vl_a)
    with CommonUtils.open_file(abs_path) as pdf_file:
        yield pdf_file
Exemplo n.º 2
0
def baosteel_certificate_pdf_sample_vl_d36():
    test_file_vl_d36 = 'J9H0001126_BGSAJ2001130008400.pdf'
    abs_path = os.path.abspath(test_file_vl_d36)
    if os.path.exists(test_file_vl_d36):
        os.remove(test_file_vl_d36)
    file_source = os.path.abspath(r"../test_data")
    shutil.copy(os.path.join(file_source, test_file_vl_d36), test_file_vl_d36)
    with CommonUtils.open_file(abs_path) as pdf_file:
        yield pdf_file
Exemplo n.º 3
0
            # check if the tensile strength value of each steel plate matches the expected value. (抗拉)
            assert plate.tensile_strength.value == expected_tensile_strength_vl_d36[
                cert_index][plate_index]
            # check if the elongation value of each steel plate matches the expected value. (伸长)
            assert plate.elongation.value == expected_elongation_vl_d36[
                cert_index][plate_index]
            # check if the direction value of each steel plate matches the expected value.
            assert plate.position_direction_impact.value == expected_position_direction_impact_vl_36[
                cert_index][plate_index]
            # check if the temperature value of each steel plate matches the expected value.
            assert plate.temperature.value == expected_temperature_vl_d36[
                cert_index][plate_index]
            # check if the impact energy values of eact steel plate match the expected values.
            current_imapct_energy_list = expected_impact_energy_list_vl_d36[
                cert_index][plate_index]
            assert len(
                plate.impact_energy_list) == len(current_imapct_energy_list)
            if len(current_imapct_energy_list) > 0:
                for impact_energy_index, impact_energy_value in enumerate(
                        current_imapct_energy_list):
                    assert plate.impact_energy_list[
                        impact_energy_index].value == impact_energy_value


if __name__ == '__main__':
    test_file_vl_a = 'J0E0061697_BGSAJ2009120012700.pdf'
    abs_path = os.path.abspath(test_file_vl_a)
    with CommonUtils.open_file(abs_path) as pdf_file:
        cert_file: PdfFile = pdf_file
        print(cert_file.tables[1])