-
-
Notifications
You must be signed in to change notification settings - Fork 900
Expand file tree
/
Copy pathtest_bsdd.py
More file actions
68 lines (46 loc) · 2.54 KB
/
test_bsdd.py
File metadata and controls
68 lines (46 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from bsdd import Client
client = Client()
ifc4x3_uri = next(l["uri"] for l in client.get_dictionary()["dictionaries"] if "4.3" in l["uri"])
nbs_uri = next(l["uri"] for l in client.get_dictionary()["dictionaries"] if "Uniclass 2015" == l["name"])
def get_ifc_classes():
return client.get_classes(ifc4x3_uri, use_nested_classes=False, class_type="Class")
def get_nbs_classes():
return client.get_classes(nbs_uri, use_nested_classes=False, class_type="Class", offset=0, limit=5)
def test_get_dictionary():
li_names = [l["name"] for l in client.get_dictionary()["dictionaries"]]
assert "Uniclass 2015" and "IFC" in li_names
def test_get_ifc_classes():
ifc4x3_classes = get_ifc_classes()
assert "IfcBoiler" and "IfcLightFixture" in [l["code"] for l in ifc4x3_classes["classes"]]
def test_get_nbs_classes():
nbs_classes = get_nbs_classes()
assert "Ac" in [l["code"] for l in nbs_classes["classes"]]
def test_get_class():
uri_light_fixture = next(l for l in get_ifc_classes()["classes"] if "IfcLightFixture" == l["code"])["uri"]
ifc4x3_light_fixture = client.get_class(uri_light_fixture)
assert "Maintenance Factor" and "Light Fixture Mounting Type" in [
l["name"] for l in ifc4x3_light_fixture["classProperties"]
]
def test_get_class_relations():
uri_light_fixture = next(l for l in get_ifc_classes()["classes"] if "IfcLightFixture" == l["code"])["uri"]
ifc4x3_light_fixture_relations = client.get_class_properties(uri_light_fixture, True)
assert "Electrical unit for light-line system" and "Tubelight system" in [
r["className"] for r in ifc4x3_light_fixture_relations["classRelations"]
]
def test_get_class_properties():
uri_light_fixture = next(l for l in get_ifc_classes()["classes"] if "IfcLightFixture" == l["code"])["uri"]
ifc4x3_light_fixture_properties = client.get_class_properties(uri_light_fixture)
assert "Maintenance Factor" and "Light Fixture Mounting Type" in [
l["name"] for l in ifc4x3_light_fixture_properties["classProperties"]
]
def test_search_class():
ss_heat_pump_sys = client.search_class("Ss_60_40_36", [nbs_uri])
li = [l + "source heat pump systems" for l in ["Air ", "Ground ", "Water "]]
assert (
len(li) < 8
) # I think it should be 4 but just validating it isn't overfetching with some space for future change
for l in li:
assert l in [_["name"] for _ in ss_heat_pump_sys["classes"]]
def test_get_properties():
pr = client.get_properties(ifc4x3_uri, offset=0, limit=5)
assert len(pr["properties"]) == 5