Ejemplo n.º 1
0
 def check_entities(self, entities: List[Tags]) -> Iterable[Tags]:
     for entity in entities:
         _, dxftype = entity[0]
         if dxftype in EXCLUDE_STRUCTURE_CHECK:
             yield entity
         else:
             # raises DXFStructureError() for invalid entities
             yield Tags(entity_structure_validator(entity))
def test_invalid_xdata():
    with pytest.raises(DXFXDataError):
        list(entity_structure_validator(compile(INVALID_XDATA_STRUCTURE_TAG)))
def test_invalid_app_data_without_opening_tag():
    with pytest.raises(DXFAppDataError):
        list(entity_structure_validator(compile(INVALID_APPDATA_NO_OPENING_TAG)))
def test_invalid_app_data_structure_tag():
    with pytest.raises(DXFAppDataError):
        list(entity_structure_validator(compile(INVALID_APPDATA_STRUCTURE_TAG)))
def test_valid_tags():
    tags = list(entity_structure_validator(compile(VALID_ENTITY)))
    assert len(tags) == 6
def test_invalid_xdata_list_nesting():
    with pytest.raises(DXFXDataError):
        list(entity_structure_validator(compile(INVALID_XDATA_LIST_NESTING)))
def test_unbalanced_xdata_list_2():
    with pytest.raises(DXFXDataError):
        list(entity_structure_validator(compile(UNBALANCED_XDATA_LIST_2)))
Ejemplo n.º 8
0
def test_xrecord_with_group_code_102():
    tags = list(
        entity_structure_validator(compile(XRECORD_WITH_GROUP_CODE_102)))
    assert tags[0] == (0, 'XRECORD')
Ejemplo n.º 9
0
def test_extended_group_code_before_XDATA():
    tags = list(
        entity_structure_validator(
            compile(BLOCKBASEPOINTPARAMETER_CVIL_3D_2018)))
    assert tags[0] == (0, 'BLOCKBASEPOINTPARAMETER')
Ejemplo n.º 10
0
def test_xrecord_with_long_closing_tag():
    tags = list(
        entity_structure_validator(compile(XRECORD_APP_DATA_LONG_CLOSING_TAG)))
    assert tags[0] == (0, 'XRECORD')
Ejemplo n.º 11
0
def test_embedded_object_follows_XDATA():
    tags = list(entity_structure_validator(compile(ENTITY_W_EMBEDDED_OBJECT)))
    assert len(tags) == 8
    assert tags[-1] == (1, 'Text')