@@ -26,18 +26,7 @@ def test_do_nothing_if_a_project_already_exists(self, ifc, project):
2626 ifc .get ().should_be_called ().will_return ("ifc" )
2727 subject .create_project (ifc , project , schema = "IFC4" , template = None )
2828
29- def test_create_an_ifc4_project (self , ifc , project ):
30- ifc .get ().should_be_called ().will_return (None )
31- ifc .run ("project.create_file" , version = "IFC4" ).should_be_called ().will_return ("ifc" )
32- ifc .set ("ifc" ).should_be_called ()
33-
34- project .create_empty ("My Project" ).should_be_called ().will_return ("project" )
35- project .create_empty ("My Site" ).should_be_called ().will_return ("site" )
36- project .create_empty ("My Building" ).should_be_called ().will_return ("building" )
37- project .create_empty ("My Storey" ).should_be_called ().will_return ("storey" )
38- project .run_root_assign_class (obj = "project" , ifc_class = "IfcProject" ).should_be_called ()
39- project .run_unit_assign_scene_units ().should_be_called ()
40-
29+ def check_contexts (self , project ):
4130 project .run_context_add_context (
4231 context_type = "Model" , context_identifier = "" , target_view = "" , parent = 0
4332 ).should_be_called ().will_return ("model" )
@@ -59,6 +48,9 @@ def test_create_an_ifc4_project(self, ifc, project):
5948 project .run_context_add_context (
6049 context_type = "Model" , context_identifier = "Annotation" , target_view = "MODEL_VIEW" , parent = "model"
6150 ).should_be_called ()
51+ project .run_context_add_context (
52+ context_type = "Model" , context_identifier = "Annotation" , target_view = "PLAN_VIEW" , parent = "model"
53+ ).should_be_called ()
6254 project .run_context_add_context (
6355 context_type = "Model" , context_identifier = "Profile" , target_view = "ELEVATION_VIEW" , parent = "model"
6456 ).should_be_called ()
@@ -75,6 +67,20 @@ def test_create_an_ifc4_project(self, ifc, project):
7567 context_type = "Plan" , context_identifier = "Annotation" , target_view = "PLAN_VIEW" , parent = "plan"
7668 ).should_be_called ()
7769
70+ def test_create_an_ifc4_project (self , ifc , project ):
71+ ifc .get ().should_be_called ().will_return (None )
72+ ifc .run ("project.create_file" , version = "IFC4" ).should_be_called ().will_return ("ifc" )
73+ ifc .set ("ifc" ).should_be_called ()
74+
75+ project .create_empty ("My Project" ).should_be_called ().will_return ("project" )
76+ project .create_empty ("My Site" ).should_be_called ().will_return ("site" )
77+ project .create_empty ("My Building" ).should_be_called ().will_return ("building" )
78+ project .create_empty ("My Storey" ).should_be_called ().will_return ("storey" )
79+ project .run_root_assign_class (obj = "project" , ifc_class = "IfcProject" ).should_be_called ()
80+ project .run_unit_assign_scene_units ().should_be_called ()
81+
82+ self .check_contexts (project )
83+
7884 project .run_root_assign_class (obj = "site" , ifc_class = "IfcSite" , context = "body" ).should_be_called ()
7985 project .run_root_assign_class (obj = "building" , ifc_class = "IfcBuilding" , context = "body" ).should_be_called ()
8086 project .run_root_assign_class (obj = "storey" , ifc_class = "IfcBuildingStorey" , context = "body" ).should_be_called ()
@@ -104,42 +110,7 @@ def test_appending_project_template_types_if_specified(self, ifc, project):
104110 project .run_root_assign_class (obj = "project" , ifc_class = "IfcProject" ).should_be_called ()
105111 project .run_unit_assign_scene_units ().should_be_called ()
106112
107- project .run_context_add_context (
108- context_type = "Model" , context_identifier = "" , target_view = "" , parent = 0
109- ).should_be_called ().will_return ("model" )
110- project .run_context_add_context (
111- context_type = "Model" , context_identifier = "Body" , target_view = "MODEL_VIEW" , parent = "model"
112- ).should_be_called ().will_return ("body" )
113- project .run_context_add_context (
114- context_type = "Model" , context_identifier = "Axis" , target_view = "GRAPH_VIEW" , parent = "model"
115- ).should_be_called ()
116- project .run_context_add_context (
117- context_type = "Model" , context_identifier = "Box" , target_view = "MODEL_VIEW" , parent = "model"
118- ).should_be_called ()
119- project .run_context_add_context (
120- context_type = "Model" , context_identifier = "Annotation" , target_view = "SECTION_VIEW" , parent = "model"
121- ).should_be_called ()
122- project .run_context_add_context (
123- context_type = "Model" , context_identifier = "Annotation" , target_view = "ELEVATION_VIEW" , parent = "model"
124- ).should_be_called ()
125- project .run_context_add_context (
126- context_type = "Model" , context_identifier = "Annotation" , target_view = "MODEL_VIEW" , parent = "model"
127- ).should_be_called ()
128- project .run_context_add_context (
129- context_type = "Model" , context_identifier = "Profile" , target_view = "ELEVATION_VIEW" , parent = "model"
130- ).should_be_called ()
131- project .run_context_add_context (
132- context_type = "Plan" , context_identifier = "" , target_view = "" , parent = 0
133- ).should_be_called ().will_return ("plan" )
134- project .run_context_add_context (
135- context_type = "Plan" , context_identifier = "Axis" , target_view = "GRAPH_VIEW" , parent = "plan"
136- ).should_be_called ()
137- project .run_context_add_context (
138- context_type = "Plan" , context_identifier = "Body" , target_view = "PLAN_VIEW" , parent = "plan"
139- ).should_be_called ()
140- project .run_context_add_context (
141- context_type = "Plan" , context_identifier = "Annotation" , target_view = "PLAN_VIEW" , parent = "plan"
142- ).should_be_called ()
113+ self .check_contexts (project )
143114
144115 project .run_root_assign_class (obj = "site" , ifc_class = "IfcSite" , context = "body" ).should_be_called ()
145116 project .run_root_assign_class (obj = "building" , ifc_class = "IfcBuilding" , context = "body" ).should_be_called ()
@@ -179,42 +150,7 @@ def test_create_an_ifc2x3_project_with_owner_defaults(self, ifc, project):
179150 project .run_root_assign_class (obj = "project" , ifc_class = "IfcProject" ).should_be_called ()
180151 project .run_unit_assign_scene_units ().should_be_called ()
181152
182- project .run_context_add_context (
183- context_type = "Model" , context_identifier = "" , target_view = "" , parent = 0
184- ).should_be_called ().will_return ("model" )
185- project .run_context_add_context (
186- context_type = "Model" , context_identifier = "Body" , target_view = "MODEL_VIEW" , parent = "model"
187- ).should_be_called ().will_return ("body" )
188- project .run_context_add_context (
189- context_type = "Model" , context_identifier = "Axis" , target_view = "GRAPH_VIEW" , parent = "model"
190- ).should_be_called ()
191- project .run_context_add_context (
192- context_type = "Model" , context_identifier = "Box" , target_view = "MODEL_VIEW" , parent = "model"
193- ).should_be_called ()
194- project .run_context_add_context (
195- context_type = "Model" , context_identifier = "Annotation" , target_view = "SECTION_VIEW" , parent = "model"
196- ).should_be_called ()
197- project .run_context_add_context (
198- context_type = "Model" , context_identifier = "Annotation" , target_view = "ELEVATION_VIEW" , parent = "model"
199- ).should_be_called ()
200- project .run_context_add_context (
201- context_type = "Model" , context_identifier = "Annotation" , target_view = "MODEL_VIEW" , parent = "model"
202- ).should_be_called ()
203- project .run_context_add_context (
204- context_type = "Model" , context_identifier = "Profile" , target_view = "ELEVATION_VIEW" , parent = "model"
205- ).should_be_called ()
206- project .run_context_add_context (
207- context_type = "Plan" , context_identifier = "" , target_view = "" , parent = 0
208- ).should_be_called ().will_return ("plan" )
209- project .run_context_add_context (
210- context_type = "Plan" , context_identifier = "Axis" , target_view = "GRAPH_VIEW" , parent = "plan"
211- ).should_be_called ()
212- project .run_context_add_context (
213- context_type = "Plan" , context_identifier = "Body" , target_view = "PLAN_VIEW" , parent = "plan"
214- ).should_be_called ()
215- project .run_context_add_context (
216- context_type = "Plan" , context_identifier = "Annotation" , target_view = "PLAN_VIEW" , parent = "plan"
217- ).should_be_called ()
153+ self .check_contexts (project )
218154
219155 project .run_root_assign_class (obj = "site" , ifc_class = "IfcSite" , context = "body" ).should_be_called ()
220156 project .run_root_assign_class (obj = "building" , ifc_class = "IfcBuilding" , context = "body" ).should_be_called ()
0 commit comments