@@ -70,6 +70,15 @@ def test_json_schema(mesh):
7070# ==============================================================================
7171
7272
73+ def test_default_vertex_attributes ():
74+ he = HalfEdge (name = 'test' , default_vertex_attributes = {'a' : 1 , 'b' : 2 })
75+ for vertex in he .vertices ():
76+ assert he .vertex_attribute (vertex , name = 'a' ) == 1
77+ assert he .vertex_attribute (vertex , name = 'b' ) == 2
78+ he .vertex_attribute (vertex , name = 'a' , value = 3 )
79+ assert he .vertex_attribute (vertex , name = 'a' ) == 3
80+
81+
7382def test_vertex_attributes_key_not_found (mesh ):
7483 with pytest .raises (KeyError ):
7584 mesh .vertex_attributes (mesh .number_of_vertices () + 1 )
@@ -111,6 +120,16 @@ def test_del_vertex_attribute_in_view(mesh, vertex_key):
111120# Tests - Face Attributes
112121# ==============================================================================
113122
123+
124+ def test_default_face_attributes ():
125+ he = HalfEdge (name = 'test' , default_face_attributes = {'a' : 1 , 'b' : 2 })
126+ for face in he .vertices ():
127+ assert he .face_attribute (face , name = 'a' ) == 1
128+ assert he .face_attribute (face , name = 'b' ) == 2
129+ he .face_attribute (face , name = 'a' , value = 3 )
130+ assert he .face_attribute (face , name = 'a' ) == 3
131+
132+
114133def test_face_attributes_is_empty (mesh ):
115134 assert mesh .face_attributes (mesh .get_any_face ()) == {}
116135
@@ -151,6 +170,16 @@ def test_del_face_attribute_in_view(mesh, face_key):
151170# Tests - Edge Attributes
152171# ==============================================================================
153172
173+
174+ def test_default_edge_attributes ():
175+ he = HalfEdge (name = 'test' , default_edge_attributes = {'a' : 1 , 'b' : 2 })
176+ for edge in he .vertices ():
177+ assert he .edge_attribute (edge , name = 'a' ) == 1
178+ assert he .edge_attribute (edge , name = 'b' ) == 2
179+ he .edge_attribute (edge , name = 'a' , value = 3 )
180+ assert he .edge_attribute (edge , name = 'a' ) == 3
181+
182+
154183def test_edge_attributes_is_empty (mesh , edge_key ):
155184 assert mesh .edge_attributes (edge_key ) == {}
156185
0 commit comments