def test_concrete_rectangular_section(): rect = cs.concrete_rectangular_section( b=300, d=600, dia_top=16, n_top=3, dia_bot=20, n_bot=3, n_circle=16, cover=30, area_top=200, area_bot=310, conc_mat=conc_mat, steel_mat=steel_mat, ) # check geometry is created correctly conc_area = 0 steel_area = 0 for geom in rect.geoms: if geom.material == conc_mat: conc_area += geom.calculate_area() elif geom.material == steel_mat: steel_area += geom.calculate_area() else: raise ValueError("Material {0} is not correctly assigned".format( geom.material)) net_area = 600 * 300 actual_steel_area = 3 * (200 + 310) # check areas check.almost_equal(conc_area, net_area - actual_steel_area, rel=r_tol) check.almost_equal(steel_area, actual_steel_area, rel=r_tol)
def test_get_reproduction_dist(): environment = model.Environment(h=500, w=500) agents = [ model.Agent(0, 0), model.Agent(0, 1), model.Agent(0, 2), model.Agent(0, 3), ] environment.agents = agents environment.heightmap[0, 0] = 8 environment.heightmap[0, 1] = 6 environment.heightmap[0, 2] = 4 environment.heightmap[0, 3] = 2 environment.rel_fitness = environment._get_relative_dist() environment.k = 1 totally_equal = environment._get_reproduction_dist() environment.k = 0 most_unequal = environment._get_reproduction_dist() environment.k = 0.5 halfway_equal = environment._get_reproduction_dist() for elt in totally_equal: check.equal(elt, 0.25) check.less(most_unequal[3], most_unequal[2]) check.less(most_unequal[2], most_unequal[1]) check.less(most_unequal[1], most_unequal[0]) for i in range(len(halfway_equal)): check.almost_equal(halfway_equal[i], 0.5*totally_equal[i] + 0.5*most_unequal[i])
def test_concrete_circular_section(): rect = cs.concrete_circular_section( d=600, n=64, dia=20, n_bar=8, n_circle=16, cover=45, area_conc=np.pi * 600 * 600 / 4, area_bar=310, conc_mat=conc_mat, steel_mat=steel_mat, ) # check geometry is created correctly conc_area = 0 steel_area = 0 for geom in rect.geoms: if geom.material == conc_mat: conc_area += geom.calculate_area() elif geom.material == steel_mat: steel_area += geom.calculate_area() else: raise ValueError("Material {0} is not correctly assigned".format( geom.material)) net_area = np.pi * 600 * 600 / 4 actual_steel_area = 8 * 310 # check areas check.almost_equal(conc_area, net_area - actual_steel_area, rel=r_tol) check.almost_equal(steel_area, actual_steel_area, rel=r_tol)
def test_it_returns_a_valid_geocode(ors_client): # Setup correct_location_line = r'{"name": "Haus der Musik", "city": "Heiden", "postal_code": "46359", "street": "Am Sportzentrum", "housenumber": "7"}' subject = MeetingLocation(ors_client, correct_location_line) # Test check.almost_equal([6.9342899, 51.8213412], subject.getGeocode())
def test_it_calculates_total_times_in_min(ors_client): subject = GroupDistanceCalculator(ors_client, [], []) test_matrix = {'durations': [[300, 600, 900], [120, 180, 1080]]} sums_minutes = [7.0, 13.0, 33.0] result = subject.totalTimes(test_matrix) check.almost_equal(result, sums_minutes, rel=0.001)
def test_it_calculates_total_distances_in_km(ors_client): subject = GroupDistanceCalculator(ors_client, [], []) test_matrix = { 'distances': [[4600.0, 1300.0], [1000.0, 2000.0], [5000.0, 7000.0]] } sums_km = [11.0, 10.0] result = subject.totalDistances(test_matrix) check.almost_equal(result, sums_km, rel=0.001)
def test_compound_rectangular_offset(): rect1 = sections.rectangular_section(d=50, b=50) rect2 = sections.rectangular_section(d=50, b=50).align_to(rect1, "right") geom = rect1 + rect2 geom = geom.offset_perimeter(amount=-5, where="exterior") geom.create_mesh([50]) section = Section(geom) section.calculate_geometric_properties() area = 90 * 40 check.almost_equal(section.get_area(), area, rel=r_tol)
def test_i_section(): i_section = steel_sections.i_section(d=308, b=305, t_f=15.4, t_w=9.9, r=16.5, n_r=16) i_section.create_mesh([100]) section = Section(i_section) section.calculate_geometric_properties() perim = ((2 * 305) + (4 * 15.4) + 2 * (305 - 9.9 - 2 * 16.5) + (2 * np.pi * 16.5) + 2 * (308 - 2 * 15.4 - 2 * 16.5)) check.almost_equal(section.get_perimeter(), perim, rel=r_tol)
def test_consume_fuel_card_norma3(api, data): """用户id(userId)为空""" request_data = data.get('test_consume_fuel_card_norma3') try: res_dict = api.request_all(request_data).json() print(f'响应数据{res_dict}') # 响应断言 ck.equal(301, res_dict.get("code")) ck.almost_equal("参数类型错误com.alibaba.fastjson.JSONException", res_dict.get("msg")) ck.is_false(res_dict.get('success')) except: pass
def test_fb_A(PeeryEx7_2_1): """Check the stress at point A.""" # Load from the text v = [-1e5, 1e4] # Coordinates of point A A = (-5, 4) # The answer in the example perfect_result = 1210 # The simplified textbook equation text_result = round(-494 * -5 + -315 * 4) nodes = PeeryEx7_2_1.xsect.mesh_nodes index, _ = get_node(nodes, A) _ = PeeryEx7_2_1.apply_load(v) computed_result = PeeryEx7_2_1.stress.get_stress()[0]["sig_zz"][index] check.almost_equal(text_result, perfect_result) check.almost_equal(computed_result, perfect_result, rel=1e-3)
def test_compound_rectangular_isection_perimeter1(): d = 300 b = 150 tf = 10 tw = 6 r = 12 b_p = 250 t_p = 16 ub = steel_sections.i_section(d=d, b=b, t_f=tf, t_w=tw, r=r, n_r=16) plate = (sections.rectangular_section( b=b_p, d=t_p).align_center(ub).align_to(ub, on="top")) geom = ub + plate geom.create_mesh([100]) section = Section(geom) section.calculate_geometric_properties() perim = (b + (4 * tf) + 2 * (b - tw - 2 * r) + (2 * np.pi * r) + 2 * (d - 2 * tf - 2 * r) + (b_p - b) + (2 * t_p) + b_p) check.almost_equal(section.get_perimeter(), perim, rel=r_tol)
def test_rectangular_offset(): # exterior negative offset rect = sections.rectangular_section(d=500, b=300) rect = rect.offset_perimeter(amount=-10, where="exterior") rect.create_mesh([200]) section = Section(rect) section.calculate_geometric_properties() area = 480 * 280 check.almost_equal(section.get_area(), area, rel=r_tol) # exterior positive offset rect = sections.rectangular_section(d=500, b=300) rect = rect.offset_perimeter(amount=10, where="exterior") rect.create_mesh([200]) section = Section(rect) section.calculate_geometric_properties() area = 520 * 320 - (20 * 20 - np.pi * 10 * 10) check.almost_equal(section.get_area(), area, rel=r_tol)
def test_compound_rectangular_isection_offset_corrode(): d = 300 b = 150 tf = 10 tw = 8 r = 12 b_p = 250 t_p = 16 ub = steel_sections.i_section(d=d, b=b, t_f=tf, t_w=tw, r=r, n_r=16) plate = (sections.rectangular_section( b=b_p, d=t_p).align_center(ub).align_to(ub, on="top")) geom_test = ub + plate geom_test = geom_test.offset_perimeter(amount=-2, where="exterior") geom_test.create_mesh([100]) section_test = Section(geom_test) section_test.calculate_geometric_properties() ub_corroded = steel_sections.mono_i_section(d=298, b_t=146, b_b=146, t_ft=8, t_fb=6, t_w=4, r=14, n_r=16) plate_corroded1 = (sections.rectangular_section( b=146, d=2).align_center(ub_corroded).align_to(ub_corroded, "top")) plate_corroded2 = (sections.rectangular_section( b=246, d=12).align_center(ub_corroded).align_to(plate_corroded1, "top")) rad_l = (draw_radius(2, 8).align_to(plate_corroded1, "left").align_to(plate_corroded2, "bottom")) rad_r = (draw_radius(2, 8).mirror_section("y", [2, 0]).align_to( plate_corroded1, "right").align_to(plate_corroded2, "bottom")) geom_corroded = ub_corroded + plate_corroded1 + plate_corroded2 + rad_l + rad_r geom_corroded.create_mesh([100]) section_corroded = Section(geom_corroded) section_corroded.calculate_geometric_properties() check.almost_equal(section_test.get_area(), section_corroded.get_area(), rel=r_tol)
def test_symmetric_fb(PeeryEx6_2_1): "Max bending stress on the section." _geom, xsect = PeeryEx6_2_1 # Defined in the text moment = 8e5 y = 3 I = xsect.section_props.ixx_g xsect.calculate_warping_properties() stress = xsect.calculate_stress(Mxx=moment) # The number quoted in the book. (Peery rounds this to the hundreds) # 55400 = 55427.3 perfect_result = 55427.3 # The number from the textbook equation computed_result = moment * y / I check.almost_equal(perfect_result, computed_result, rel=1e-3) # The max stress, computed through FEA on our mesh. numerical_result = max(stress.get_stress()[0]["sig_zz"]) check.almost_equal(numerical_result, perfect_result, rel=1e-3)
def test_fb_C(PeeryEx7_2_1): """Check the stress at point C.""" # Load from the text v = [-1e5, 1e4] # Coordinates of point C C = (1, 6) # The answer in the example # For this point, Peery rounds to the tens place, # thus -2380 is the exact number written in the book # but -2384 is the answer computed from his values. perfect_result = -2384 # The simplified textbook equation text_result = round(-494 * 1 + -315 * 6) nodes = PeeryEx7_2_1.xsect.mesh_nodes assert len(nodes > 0) index, _ = get_node(nodes, C) _ = PeeryEx7_2_1.apply_load(v) computed_result = PeeryEx7_2_1.stress.get_stress()[0]["sig_zz"][index] check.almost_equal(text_result, perfect_result) check.almost_equal(computed_result, perfect_result, rel=1e-3)
def test_call_key_hook(self, mocker, timescale, hook): time = 0.1 if hook == 'begin' else 0.123 value = 17 if timescale != 'run' else None logs = {'log': 7} t_begin_name = f't_{timescale}_begin' dt_name = f'dt_{timescale}' hook_name = f'on_{timescale}_{hook}' mocker.patch('time.time', return_value=time) mocker.patch('learnrl.callbacks.callback.Callback.' + hook_name) callbacks = CallbackList(self.callbacks) if hook == 'end': setattr(callbacks, t_begin_name, 0.1) callbacks._call_key_hook(timescale, hook, value=value, logs=logs) if hook == 'end': check.almost_equal(logs.get(dt_name), 0.023) for callback in self.callbacks: check.is_true(getattr(callback, hook_name).called)
def test_compound_rhs_isection_perimeter(): d = 200 b = 150 t = 9 r = 15 b_p = 250 t_p = 16 rhs = steel_sections.rectangular_hollow_section(d=d, b=b, t=t, r_out=r, n_r=16) plate1 = (sections.rectangular_section( b=b_p, d=t_p).align_center(rhs).align_to(rhs, on="top")) plate2 = (sections.rectangular_section( b=b_p, d=t_p).align_center(rhs).align_to(rhs, on="bottom")) geom = rhs + plate1 + plate2 geom.create_mesh([100]) section = Section(geom) section.calculate_geometric_properties() perim = ((2 * b_p) + (4 * t_p) + 2 * (b_p - b + 2 * r) + (2 * np.pi * r) + 2 * (d - 2 * r)) check.almost_equal(section.get_perimeter(), perim, rel=r_tol)
def test_almost_equal(): check.almost_equal(1, 1) check.almost_equal(1, 1.1, abs=0.2) check.almost_equal(2, 1, rel=1)
def test_box_offset(): # exterior negative offset box = steel_sections.rectangular_hollow_section(d=200, b=100, t=10, r_out=0, n_r=1) box = box.offset_perimeter(amount=-5, where="exterior") box.create_mesh([50]) section = Section(box) section.calculate_geometric_properties() area = 190 * 90 - 180 * 80 check.almost_equal(section.get_area(), area, rel=r_tol) # exterior positve offset box = steel_sections.rectangular_hollow_section(d=200, b=100, t=10, r_out=0, n_r=1) box = box.offset_perimeter(amount=5, where="exterior") box.create_mesh([50]) section = Section(box) section.calculate_geometric_properties() area = 210 * 110 - (10 * 10 - np.pi * 5 * 5) - 180 * 80 check.almost_equal(section.get_area(), area, rel=r_tol) # interior negative offset box = steel_sections.rectangular_hollow_section(d=200, b=100, t=10, r_out=0, n_r=1) box = box.offset_perimeter(amount=-5, where="interior") box.create_mesh([50]) section = Section(box) section.calculate_geometric_properties() area = 200 * 100 - 170 * 70 check.almost_equal(section.get_area(), area, rel=r_tol) # interior positive offset box = steel_sections.rectangular_hollow_section(d=200, b=100, t=10, r_out=0, n_r=1) box = box.offset_perimeter(amount=5, where="interior") box.create_mesh([50]) section = Section(box) section.calculate_geometric_properties() area = 200 * 100 - 190 * 90 + (10 * 10 - np.pi * 5 * 5) check.almost_equal(section.get_area(), area, rel=r_tol) # all negative offset box = steel_sections.rectangular_hollow_section(d=200, b=100, t=10, r_out=0, n_r=1) box = box.offset_perimeter(amount=-2.5, where="all") box.create_mesh([50]) section = Section(box) section.calculate_geometric_properties() area = 195 * 95 - 185 * 85 + (5 * 5 - np.pi * 2.5 * 2.5) check.almost_equal(section.get_area(), area, rel=r_tol) # all positive offset box = steel_sections.rectangular_hollow_section(d=200, b=100, t=10, r_out=0, n_r=1) box = box.offset_perimeter(amount=5, where="all") box.create_mesh([50]) section = Section(box) section.calculate_geometric_properties() area = 210 * 110 - (10 * 10 - np.pi * 5 * 5) - 170 * 70 check.almost_equal(section.get_area(), area, rel=r_tol)
def test_rectangular_section_plastic(): check.almost_equal(rectangle_section.get_pc(), (50 / 2, 100 / 2)) check.almost_equal(rectangle_section.get_pc_p(), (50 / 2, 100 / 2)) check.almost_equal(rectangle_section.get_s(), (50 * 100**2 / 4, 100 * 50**2 / 4)) check.almost_equal(rectangle_section.get_sp(), (50 * 100**2 / 4, 100 * 50**2 / 4)) check.almost_equal(rectangle_section.get_sf(), (1.5, 1.5, 1.5, 1.5)) check.almost_equal(rectangle_section.get_sf_p(), (1.5, 1.5, 1.5, 1.5))
def test_rectangular_section_warping(): check.almost_equal(rectangle_section.section_props.j, 2861002, rel=2 * warp_tol) # roark's # check.almost_equal(rectangle_section.section_props.j, 2.85852e6, rel=2e-5) #st7 check.almost_equal(rectangle_section.section_props.j, 2.861326e06, rel=tol) # main branch check.almost_equal(rectangle_section.section_props.gamma, 3.177234e08, rel=tol) # main branch check.almost_equal(rectangle_section.get_sc(), (50 / 2, 100 / 2), rel=warp_tol) check.almost_equal(rectangle_section.get_sc_p(), (-4.103589e-04, 1.164891e-03), rel=tol) check.almost_equal(rectangle_section.get_sc_t(), (50 / 2, 100 / 2), rel=warp_tol) check.almost_equal(rectangle_section.get_As(), (4.168418e03, 4.166821e03), rel=tol) check.almost_equal(rectangle_section.get_As_p(), (4.168418e03, 4.166821e03), rel=tol)
def test_rectangular_section_geometric(): check.almost_equal(rectangle_section.section_props.area, 100 * 50, rel=tol) check.almost_equal(rectangle_section.section_props.perimeter, 2 * 100 + 2 * 50, rel=tol) check.almost_equal(rectangle_section.section_props.mass, 1 * 100 * 50, rel=tol) check.almost_equal(rectangle_section.section_props.ea, 1 * 100 * 50, rel=tol) check.almost_equal(rectangle_section.section_props.qx, 100 * 50 * 50, rel=tol) check.almost_equal(rectangle_section.section_props.qy, 100 * 50 * 25, rel=tol) check.almost_equal(rectangle_section.section_props.ixx_g, 50 * 100**3 / 3, rel=tol) check.almost_equal(rectangle_section.section_props.iyy_g, 100 * 50**3 / 3, rel=tol) check.almost_equal(rectangle_section.section_props.ixy_g, 100 * 50 * 50 * 25, rel=tol) check.almost_equal(rectangle_section.section_props.cx, 50 / 2, rel=tol) check.almost_equal(rectangle_section.section_props.cy, 100 / 2, rel=tol) check.almost_equal(rectangle_section.section_props.ixx_c, 50 * 100**3 / 12, rel=tol) check.almost_equal(rectangle_section.section_props.iyy_c, 100 * 50**3 / 12, rel=tol) check.almost_equal(rectangle_section.section_props.ixy_c, 0, abs=tol) check.almost_equal(rectangle_section.section_props.zxx_plus, 50 * 100**2 / 6, rel=tol) check.almost_equal(rectangle_section.section_props.zxx_minus, 50 * 100**2 / 6, rel=tol) check.almost_equal(rectangle_section.section_props.zyy_plus, 100 * 50**2 / 6, rel=tol) check.almost_equal(rectangle_section.section_props.zyy_minus, 100 * 50**2 / 6, rel=tol) check.almost_equal( rectangle_section.section_props.rx_c, (50 * 100**3 / 12 / 100 / 50)**0.5, rel=tol, ) check.almost_equal( rectangle_section.section_props.ry_c, (100 * 50**3 / 12 / 100 / 50)**0.5, rel=tol, ) check.almost_equal(rectangle_section.section_props.i11_c, (50 * 100**3 / 12), rel=tol) check.almost_equal(rectangle_section.section_props.i22_c, (100 * 50**3 / 12), rel=tol) check.almost_equal(rectangle_section.section_props.phi, 0, rel=tol) check.almost_equal(rectangle_section.section_props.z11_plus, 50 * 100**2 / 6, rel=tol) check.almost_equal(rectangle_section.section_props.z11_minus, 50 * 100**2 / 6, rel=tol) check.almost_equal(rectangle_section.section_props.z22_plus, 100 * 50**2 / 6, rel=tol) check.almost_equal(rectangle_section.section_props.z22_minus, 100 * 50**2 / 6, rel=tol) check.almost_equal( rectangle_section.section_props.r11_c, (50 * 100**3 / 12 / 100 / 50)**0.5, rel=tol, ) check.almost_equal( rectangle_section.section_props.r22_c, (100 * 50**3 / 12 / 100 / 50)**0.5, rel=tol, )
def test_angle_all_properties(): check.almost_equal(angle_section.section_props.area, 2747.059) check.almost_equal(angle_section.section_props.perimeter, 471.3501) check.almost_equal(angle_section.section_props.cx, 2.122282e1) check.almost_equal(angle_section.section_props.cy, 5.098127e1) check.almost_equal(angle_section.section_props.ixx_g, 1.342632e7) check.almost_equal(angle_section.section_props.iyy_g, 2.955753e6) check.almost_equal(angle_section.section_props.ixy_g, 1.086603e6) check.almost_equal(angle_section.section_props.ixx_c, 6.286470e6) check.almost_equal(angle_section.section_props.iyy_c, 1.718455e6) check.almost_equal(angle_section.section_props.ixy_c, -1.885622e6) check.almost_equal(angle_section.section_props.zxx_plus, 6.348769e4) check.almost_equal(angle_section.section_props.zxx_minus, 1.233094e5) check.almost_equal(angle_section.section_props.zyy_plus, 2.498584e04) check.almost_equal(angle_section.section_props.zyy_minus, 8.097207e4) check.almost_equal(angle_section.section_props.rx_c, 4.783761e1) check.almost_equal(angle_section.section_props.ry_c, 2.501124e1) check.almost_equal(angle_section.section_props.i11_c, 6.964263e6) check.almost_equal(angle_section.section_props.i22_c, 1.040662e6) check.almost_equal(angle_section.section_props.phi, -1.602289e2) check.almost_equal(angle_section.section_props.z11_plus, 9.775662e4) check.almost_equal(angle_section.section_props.z11_minus, 6.939239e4) check.almost_equal(angle_section.section_props.z22_plus, 2.796211e4) check.almost_equal(angle_section.section_props.z22_minus, 2.076613e4) check.almost_equal(angle_section.section_props.r11_c, 5.035048e1) check.almost_equal(angle_section.section_props.r22_c, 1.946350e1) check.almost_equal(angle_section.section_props.sxx, 1.135392e5) check.almost_equal( angle_section.section_props.syy, 4.572267e4 ) # Altered from 4.572269e4 check.almost_equal(angle_section.section_props.sf_xx_plus, 1.788366) check.almost_equal(angle_section.section_props.sf_xx_minus, 9.207672e-1) check.almost_equal( angle_section.section_props.sf_yy_plus, 1.829943 ) # Altered from 1.829944 check.almost_equal( angle_section.section_props.sf_yy_minus, 5.646721e-1 ) # Altered from 5.646723e-1 check.almost_equal(angle_section.section_props.s11, 1.210275e5) check.almost_equal(angle_section.section_props.s22, 4.376054e4) check.almost_equal(angle_section.section_props.sf_11_plus, 1.238049) check.almost_equal(angle_section.section_props.sf_11_minus, 1.744103) check.almost_equal(angle_section.section_props.sf_22_plus, 1.564994) check.almost_equal(angle_section.section_props.sf_22_minus, 2.107303) check.almost_equal( angle_section.section_props.j, 1.354663e5 ) # Altered from 1.354663e5 check.almost_equal(angle_section.section_props.gamma, 162220735.49) check.almost_equal(angle_section.section_props.A_s11, 8.855951e2) check.almost_equal(angle_section.section_props.A_s22, 1.460240e3) check.almost_equal(angle_section.section_props.x11_se, 2.870404e1) check.almost_equal(angle_section.section_props.y22_se, 3.522141e1)
def test_custom_section_all_properties(): check.almost_equal(custom_section.section_props.area, 4250) check.almost_equal(custom_section.section_props.cx, 4.933333e1) check.almost_equal(custom_section.section_props.cy, 6.501961e1) check.almost_equal(custom_section.section_props.ixx_g, 2.567250e7) check.almost_equal(custom_section.section_props.iyy_g, 1.418583e7) check.almost_equal(custom_section.section_props.ixy_g, 1.379792e7) check.almost_equal(custom_section.section_props.ixx_c, 7.705415e6) check.almost_equal(custom_section.section_props.iyy_c, 3.842278e6) check.almost_equal(custom_section.section_props.ixy_c, 1.654722e5) check.almost_equal(custom_section.section_props.zxx_plus, 1.713061e5) check.almost_equal(custom_section.section_props.zxx_minus, 1.185091e5) check.almost_equal(custom_section.section_props.zyy_plus, 6.333425e4) check.almost_equal(custom_section.section_props.zyy_minus, 6.475749e4) check.almost_equal(custom_section.section_props.rx_c, 4.257979e01) check.almost_equal(custom_section.section_props.ry_c, 3.006768e1) check.almost_equal(custom_section.section_props.phi, -2.448209) check.almost_equal(custom_section.section_props.i11_c, 7.712490e6) check.almost_equal(custom_section.section_props.i22_c, 3.835203e6) check.almost_equal(custom_section.section_props.z11_plus, 1.622630e5) check.almost_equal(custom_section.section_props.z11_minus, 1.142680e5) check.almost_equal(custom_section.section_props.z22_plus, 6.050295e4) check.almost_equal(custom_section.section_props.z22_minus, 6.266613e4) check.almost_equal(custom_section.section_props.r11_c, 4.259934e1) check.almost_equal(custom_section.section_props.r22_c, 3.003998e1) check.almost_equal(custom_section.section_props.sxx, 1.531971e5) check.almost_equal(custom_section.section_props.syy, 1.014943e5) check.almost_equal( custom_section.get_sf(), (8.942884e-01, 1.292703, 1.602519, 1.567298) ) check.almost_equal(custom_section.section_props.s11, 1.533463e5) check.almost_equal(custom_section.section_props.s22, 1.015010e5) check.almost_equal(custom_section.section_props.sf_11_plus, 9.450478e-1) check.almost_equal(custom_section.section_props.sf_11_minus, 1.341988) check.almost_equal(custom_section.section_props.sf_22_plus, 1.677621) check.almost_equal(custom_section.section_props.sf_22_minus, 1.619711) check.almost_equal(custom_section.section_props.j, 3.477399e5) check.almost_equal(custom_section.section_props.gamma, 7.532929e9) check.almost_equal(custom_section.section_props.A_s11, 2.945692e3) check.almost_equal(custom_section.section_props.A_s22, 9.564143e2) check.almost_equal(custom_section.section_props.x11_se, 1.916270) check.almost_equal(custom_section.section_props.y22_se, 3.017570)
def test_symmetric_ixx(PeeryEx6_2_1): # Directly from the example, we know that # the 2nd moment of inertia resisting bending is. _geom, xsect = PeeryEx6_2_1 check.almost_equal(xsect.section_props.ixx_g, 43.3, rel=1e-3)
def test_line_values(): # Comment recognition check.equal(lines[0].comment, True) check.equal(lines[1].comment, False) # Line fields check.equal(lines[0].layer, 42) check.equal(lines[1].layer, 0) check.equal(lines[0].style, "Default") check.equal(lines[1].style, "Normal") check.equal(lines[0].actor, "Test") check.equal(lines[1].actor, "") check.equal(lines[0].effect, "Test; Wow") check.equal(lines[1].effect, "") check.equal(lines[0].margin_l, 1) check.equal(lines[1].margin_l, 0) check.equal(lines[0].margin_r, 2) check.equal(lines[1].margin_r, 0) check.equal(lines[0].margin_v, 3) check.equal(lines[1].margin_v, 50) check.equal(lines[1].start_time, Convert.time("0:00:00.00")) check.equal(lines[1].end_time, Convert.time("0:00:09.99")) check.equal(lines[1].duration, Convert.time("0:00:09.99") - Convert.time("0:00:00.00")) check.equal( lines[11].raw_text, "{\\k56}{\\1c&HFFFFFF&}su{\\k13}re{\\k22}chi{\\k36}ga{\\k48}u {\\k25\\-Pyon}{\\k34}ko{\\k33}to{\\k50}ba {\\k15}no {\\k17}u{\\k34}ra {\\k46}ni{\\k33} {\\k28}to{\\k36}za{\\k65}sa{\\1c&HFFFFFF&\\k33\\1c&HFFFFFF&\\k30\\1c&HFFFFFF&}re{\\k51\\-FX}ta{\\k16} {\\k33}ko{\\k33}ko{\\k78}ro {\\k15}no {\\k24}ka{\\k95}gi", ) check.equal(lines[11].text, "surechigau kotoba no ura ni tozasareta kokoro no kagi") # Normal style (no bold, italic and with a normal fs) check.almost_equal(lines[1].width, 437.75, abs=max_deviation) check.almost_equal(lines[1].height, 48.0, abs=max_deviation) check.almost_equal(lines[1].ascent, 36.984375, abs=max_deviation) check.almost_equal(lines[1].descent, 11.015625, abs=max_deviation) if sys.platform == "win32": check.equal(lines[1].internal_leading, 13.59375) check.equal(lines[1].external_leading, 3.09375) check.almost_equal(lines[1].x, lines[1].center, abs=max_deviation) check.almost_equal(lines[1].y, lines[1].top, abs=max_deviation) check.almost_equal(lines[1].left, 421.125, abs=max_deviation) check.almost_equal(lines[1].center, 640.0, abs=max_deviation) check.almost_equal(lines[1].right, 858.875, abs=max_deviation) check.almost_equal(lines[1].top, 50.0, abs=max_deviation) check.almost_equal(lines[1].middle, 74.0, abs=max_deviation) check.almost_equal(lines[1].bottom, 98.0, abs=max_deviation) # Bold style check.almost_equal(lines[2].width, 461.609375, abs=max_deviation) check.almost_equal(lines[2].height, 48.0, abs=max_deviation) # Italic style check.almost_equal(lines[3].width, 437.75, abs=max_deviation) check.almost_equal(lines[3].height, 48.0, abs=max_deviation) # Bold-italic style check.almost_equal(lines[4].width, 461.609375, abs=max_deviation) check.almost_equal(lines[4].height, 48.0, abs=max_deviation) # Normal-spaced style check.almost_equal(lines[5].width, 572.75, abs=max_deviation) check.almost_equal(lines[5].height, 48.0, abs=max_deviation) # Normal - fscx style check.almost_equal(lines[6].width, 612.8499999999999, abs=max_deviation) check.almost_equal(lines[6].height, 48.0, abs=max_deviation) # Normal - fscy style check.almost_equal(lines[7].width, 437.75, abs=max_deviation) check.almost_equal(lines[7].height, 67.19999999999999, abs=max_deviation) # Normal - Big FS check.almost_equal(lines[8].width, 820.796875, abs=max_deviation) check.almost_equal(lines[8].height, 90.0, abs=max_deviation) # Normal - Big FS - Spaced check.almost_equal(lines[9].width, 1090.796875, abs=max_deviation) check.almost_equal(lines[9].height, 90.0, abs=max_deviation) # Bold - Text with non latin characters (kanji) check.almost_equal(lines[10].width, 309.65625, abs=max_deviation) check.almost_equal(lines[10].height, 48.0, abs=max_deviation) # Bold - Text with some tags check.almost_equal(lines[11].width, 941.703125, abs=max_deviation) check.almost_equal(lines[11].height, 48.0, abs=max_deviation) # Bold - Vertical Text check.almost_equal(lines[12].width, 31.546875, abs=max_deviation) check.almost_equal(lines[12].height, 396.0, abs=max_deviation)
def test_unsymmetric_i22(PeeryEx7_2_1): # Directly from the example, we know what # the section properties should be. xsect = PeeryEx7_2_1.xsect check.almost_equal(xsect.section_props.i22_c, 79.5, rel=1e-3)
def equal(x, y): nonlocal i check.almost_equal(x, expectedList[i], abs=max_deviation) check.almost_equal(y, expectedList[i + 1], abs=max_deviation) i += 2