Best Python code snippet using Airtest
test_detector.py
Source:test_detector.py  
...7    a_1=0.4, a_2=0.3, tilt_1=0.5, tilt_2=1.0,8    phi_12=1.7, phi_jl=0.3, luminosity_distance=2000., theta_jn=0.4, psi=2.659,9    phase=1.3, geocent_time=1126259642.413, ra=1.375, dec=-1.2108)10@pytest.fixture11def init_detector():12    det = Detector(name='H1', sampling_frequency=4096, duration=1, start_time=0)13    assert det._show_detectors() == print(det.ifo)14    return det15@pytest.fixture16def init_source():17    source = Source(base='bilby', conversion='BBH', sampling_frequency=8192, duration=8)18    return source19def test_property(init_detector, init_source):20    assert len(init_detector.time_domain_strain) == 409621    assert len(init_detector.frequency_domain_strain) == 204922    assert len(init_detector.frequency_domain_whitened_strain) == 204923    assert len(init_detector.time_domain_whitened_strain) == 409624    assert init_detector.ifo.strain_data.start_time == 025    assert numpy.allclose(init_detector.frequency_array,...test_apis.py
Source:test_apis.py  
1import os2from pathlib import Path3import pytest4from mmdet.apis import init_detector5def test_init_detector():6    project_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))7    project_dir = os.path.join(project_dir, '..')8    config_file = os.path.join(9        project_dir, 'configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py')10    # test init_detector with config_file: str and cfg_options11    cfg_options = dict(12        model=dict(13            backbone=dict(14                depth=18,15                init_cfg=dict(16                    type='Pretrained', checkpoint='torchvision://resnet18'))))17    model = init_detector(config_file, device='cpu', cfg_options=cfg_options)18    # test init_detector with :obj:`Path`19    config_path_object = Path(config_file)20    model = init_detector(config_path_object, device='cpu')21    # test init_detector with undesirable type22    with pytest.raises(TypeError):23        config_list = [config_file]...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
