def test_setting_source_block_reference_a_second_time_has_no_effect(): e = DXFEntity() insert = Insert() e.set_source_block_reference(insert) e.set_source_block_reference(Insert()) assert (e.source_block_reference is insert), "source block reference should not change"
def test_do_not_copy_source_block_reference(): e = DXFEntity() insert = Insert() e.set_source_block_reference(insert) copy = e.copy() assert copy.has_source_block_reference is False assert copy.source_block_reference is None
def insert(): return Insert.new(dxfattribs={ 'name': 'AXIS', 'insert': (0, 0, 0), 'xscale': 1, 'yscale': 1, 'zscale': 1, 'rotation': 0, }, doc=doc1), [(0, 0, 0), X_AXIS, Y_AXIS, Z_AXIS]
def test_mcount_property(): insert = Insert.new() insert.grid(size=(2, 2), spacing=(10, 10)) assert insert.mcount == 4 insert.grid(size=(2, 2), spacing=(10, 0)) assert insert.mcount == 2 insert.grid(size=(2, 2), spacing=(0, 10)) assert insert.mcount == 2 insert.grid(size=(2, 2), spacing=(0, 0)) assert insert.mcount == 1
def insert(): return ( Insert.new( dxfattribs={ "name": "AXIS", "insert": (0, 0, 0), "xscale": 1, "yscale": 1, "zscale": 1, "rotation": 0, }, doc=doc1, ), [(0, 0, 0), X_AXIS, Y_AXIS, Z_AXIS], )
def draw_insert(insert: Insert): self.draw_entities(insert.attribs) # draw_entities() includes the visibility check: self.draw_entities( insert.virtual_entities( skipped_entity_callback=self.skip_entity))
def test_setting_source_block_reference_twice_without_exception(): e = DXFEntity() e.set_source_block_reference(Insert()) e.set_source_block_reference(Insert()) assert True is True
def test_set_source_block_reference(): e = DXFEntity() insert = Insert() e.set_source_block_reference(insert) assert e.has_source_block_reference is True assert e.source_block_reference is insert
def draw_insert(insert: Insert): self.draw_entities(insert.attribs) # draw_entities() includes the visibility check: self.draw_entities(insert.virtual_entities())