File: test_acad_table.py

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (39 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#  Copyright (c) 2021, Manfred Moitzi
#  License: MIT License
import pytest

from pathlib import Path
import ezdxf
from ezdxf.protocols import query_virtual_entities

DATA = Path(__file__).parent / "data"
ACAD_TABLE_WITH_BLK_REF = "acad_table_with_blk_ref.dxf"


@pytest.fixture(scope="module")
def doc():
    return ezdxf.readfile(DATA / ACAD_TABLE_WITH_BLK_REF)


@pytest.fixture
def acad_table(doc):
    msp = doc.modelspace()
    return msp.query("ACAD_TABLE").first


def test_virtual_entities_from_block(acad_table):
    content = query_virtual_entities(acad_table)
    assert len(content) == 42
    # Provides real INSERT entities:
    assert sum(int(e.dxftype() == "INSERT") for e in content) == 1


def test_virtual_entities_from_proxy_graphic(acad_table):
    content = list(acad_table.proxy_graphic_content())
    assert len(content) == 45
    # Does not provide INSERT entities:
    assert sum(int(e.dxftype() == "INSERT") for e in content) == 0


if __name__ == '__main__':
    pytest.main([__file__])