refactor code by black
@@ -5,33 +5,35 @@ import pytest
import ezdxf
from ezdxf.audit import Auditor
-@pytest.fixture(scope='module')
+
+@pytest.fixture(scope="module")
def doc():
return ezdxf.new()
def test_new_group(doc):
msp = doc.modelspace()
- group = doc.groups.new('test1')
+ group = doc.groups.new("test1")
with group.edit_data() as g:
g.append(msp.add_point((0, 0)))
g.append(msp.add_line((1, 1), (2, 2)))
assert len(group) == 2
- assert group[0].dxftype() == 'POINT'
- assert group[1].dxftype() == 'LINE'
+ assert group[0].dxftype() == "POINT"
+ assert group[1].dxftype() == "LINE"
assert len(list(group.handles())) == 2
handle = group[0].dxf.handle
assert handle in group
+
def test_unique_groups(doc):
- doc.groups.new('test2')
+ doc.groups.new("test2")
with pytest.raises(ValueError):
- doc.groups.new('test2')
+ doc.groups.new("test2")
def test_modify_group(doc):
msp = doc.modelspace()
- group = doc.groups.new('test3')
+ group = doc.groups.new("test3")
with group.edit_data() as g:
g.append(msp.add_point((0, 0)))
g.append(msp.add_line((1, 1), (2, 2)))
@@ -45,7 +47,7 @@ def test_modify_group(doc):
def test_can_not_add_invalid_block_entities(doc):
- group = doc.groups.new('test4')
+ group = doc.groups.new("test4")
block = doc.blocks.new("Block4")
point = block.add_point((0, 0))
with pytest.raises(ezdxf.DXFStructureError):
@@ -54,7 +56,7 @@ def test_can_not_add_invalid_block_entities(doc):
def test_can_not_add_invalid_table_entry(doc):
- group = doc.groups.new('test5')
+ group = doc.groups.new("test5")
layer = doc.layers.get("0")
with pytest.raises(ezdxf.DXFStructureError):
with group.edit_data() as g:
@@ -62,7 +64,7 @@ def test_can_not_add_invalid_table_entry(doc):
def test_audit_filters_invalid_entities(doc):
- group = doc.groups.new('test6')
+ group = doc.groups.new("test6")
msp = doc.modelspace()
block = doc.blocks.new("Block6")
point1 = block.add_point((0, 0)) # invalid BLOCK entity
@@ -76,5 +78,5 @@ def test_audit_filters_invalid_entities(doc):
assert len(group) == 0
-if __name__ == '__main__':
+if __name__ == "__main__":
pytest.main([__file__])
