예제 #1
0
def test_read_thumbnail_top_level_relationships():
    with OCMFile(TEST_PACKAGE) as package:
        relationships = package.read_relationships(
            '/',
            'http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail'
        )

    assert len(relationships) == 1
    assert relationships[
        0].Type == 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail'
    assert relationships[0].Target == '/Metadata/thumbnail.png'
예제 #2
0
def test_read_gcode_top_level_relationships():
    with OCMFile(TEST_PACKAGE) as package:
        relationships = package.read_relationships(
            '/',
            'http://schemas.oneclickmetal.com/package/2020/relationships/mprint/gcode'
        )

    assert len(relationships) == 1
    assert relationships[
        0].Type == 'http://schemas.oneclickmetal.com/package/2020/relationships/mprint/gcode'
    assert relationships[0].Target == '/3D/model.gcode'
예제 #3
0
def test_read_description():
    with OCMFile(TEST_PACKAGE) as package:
        assert package.job_description.creation_date == '2009-01-01T12:00:00+01:00'
        assert package.job_description.slicer_id == 'mprep-v0.0.1+4b3e5bf'
        assert package.job_description.job_id == '9a14926b-9783-482f-ac2a-31d8e3901833'
        assert package.job_description.estimated_print_time_seconds == 239232
        assert package.job_description.powder_consumption == 4628
        assert package.job_description.layer_count == 2314

        parts = package.job_description.parts
        assert len(parts) == 3
        assert any([
            part.id == '3' and part.name == 'Part 3'
            and part.bounding_box is not None and part.bounding_box.x1 == 12.2
            for part in parts
        ])
예제 #4
0
def test_read_parameters():
    with OCMFile(TEST_PACKAGE) as package:
        assert package.job_parameters.material == 1
        assert almost_equal(package.job_parameters.layer_height, 0.02)
        assert almost_equal(package.job_parameters.oxygen_level_target, 0.3)
        assert almost_equal(package.job_parameters.gas_circulation_speed, 1.5)
예제 #5
0
def test_read_gcode():
    with OCMFile(TEST_PACKAGE) as package:
        gcode = package.read_part(package.gcode_part)

    assert gcode == b'G0 X0 Y0'
예제 #6
0
def test_read_all_top_level_relationships():
    with OCMFile(TEST_PACKAGE) as package:
        relationships = package.read_relationships('/')

    assert len(relationships) == 2
예제 #7
0
def test_read_non_existing_part_relationships():
    with OCMFile(TEST_PACKAGE) as package:
        with pytest.raises(PartNotFoundException):
            relationships = package.read_relationships('/3D/doesnt.exist')
예제 #8
0
def test_read_existing_part_without_relationships():
    with OCMFile(TEST_PACKAGE) as package:
        relationships = package.read_relationships('/Metadata/thumbnail.png')

    assert relationships == []
예제 #9
0
def test_read_existing_part_relationships():
    with OCMFile(TEST_PACKAGE) as package:
        relationships = package.read_relationships('/3D/model.gcode')

    assert len(relationships) == 3