| 1 |
# BIMTester - OpenBIM Auditing Tool |
| 2 |
# Copyright (C) 2021 Dion Moult <[email protected]> |
| 3 |
# |
| 4 |
# This file is part of BIMTester. |
| 5 |
# |
| 6 |
# BIMTester is free software: you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU Lesser General Public License as published by |
| 8 |
# the Free Software Foundation, either version 3 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# BIMTester is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU Lesser General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU Lesser General Public License |
| 17 |
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
|
| 19 |
from behave import step |
| 20 |
|
| 21 |
from bimtester.ifc import IfcStore |
| 22 |
from bimtester.lang import _ |
| 23 |
|
| 24 |
|
| 25 |
@step('The IFC file must be exported by application full name "{fullname}"') |
| 26 |
def step_impl(context, fullname): |
| 27 |
|
| 28 |
real_fullname = IfcStore.file.by_type("IfcApplication")[0].ApplicationFullName |
| 29 |
assert real_fullname == fullname, ( |
| 30 |
"The IFC file was not exported by application full name {} " |
| 31 |
"instead it was exported by application full name {}".format(fullname, real_fullname) |
| 32 |
) |
| 33 |
|
| 34 |
|
| 35 |
@step('The IFC file must be exported by application identifier "{identifier}"') |
| 36 |
def step_impl(context, identifier): |
| 37 |
|
| 38 |
real_identifier = IfcStore.file.by_type("IfcApplication")[0].ApplicationIdentifier |
| 39 |
assert ( |
| 40 |
real_identifier == identifier |
| 41 |
), "The IFC file was not exported by application identifier {} " "instead it was exported by identifier {}".format( |
| 42 |
identifier, real_identifier |
| 43 |
) |
| 44 |
|
| 45 |
|
| 46 |
@step('The IFC file must be exported by the application version "{version}"') |
| 47 |
def step_impl(context, version): |
| 48 |
|
| 49 |
real_version = IfcStore.file.by_type("IfcApplication")[0].Version |
| 50 |
assert ( |
| 51 |
real_version == version |
| 52 |
), "The IFC file was not exported by application version {} " "instead it was exported by version {}".format( |
| 53 |
version, real_version |
| 54 |
) |
| 55 |
|
| 56 |
|
| 57 |
@step( |
| 58 |
'IFC data header must have a file description of "{header_file_description}" such as the new Allplan IFC exporter creates it' |
| 59 |
) |
| 60 |
def step_impl(context, header_file_description): |
| 61 |
|
| 62 |
is_header_file_description = IfcStore.file.wrapped_data.header.file_description.description |
| 63 |
assert ( |
| 64 |
str(is_header_file_description) == header_file_description |
| 65 |
), "The file was not exported by the new ifc exporter in Allplan. File description header: {}".format( |
| 66 |
is_header_file_description |
| 67 |
) |