Run black on IfcOpenShell-python.

This commit is contained in:
Dion Moult
2022-01-10 15:42:24 +11:00
parent 256f40ed44
commit 666e484b2b
32 changed files with 368 additions and 242 deletions
@@ -12,7 +12,10 @@ class TestAddApplication(test.bootstrap.IFC4):
assert developer.is_a("IfcOrganization")
assert developer.Identification == "IfcOpenShell"
assert developer.Name == "IfcOpenShell"
assert developer.Description == "IfcOpenShell is an open source software library that helps users and software developers to work with IFC data."
assert (
developer.Description
== "IfcOpenShell is an open source software library that helps users and software developers to work with IFC data."
)
assert developer.Roles[0].Role == "USERDEFINED"
assert developer.Roles[0].UserDefinedRole == "CONTRIBUTOR"
assert developer.Addresses[0].is_a("IfcTelecomAddress")
@@ -13,8 +13,8 @@ class TestCreateOwnerHistory(test.bootstrap.IFC4):
old_get_application = ifcopenshell.api.owner.settings.get_application
user = self.file.createIfcPersonAndOrganization()
application = self.file.createIfcApplication()
ifcopenshell.api.owner.settings.get_user = lambda x : user
ifcopenshell.api.owner.settings.get_application = lambda x : application
ifcopenshell.api.owner.settings.get_user = lambda x: user
ifcopenshell.api.owner.settings.get_application = lambda x: application
history = ifcopenshell.api.run("owner.create_owner_history", self.file)
ifcopenshell.api.owner.settings.get_user = old_get_user
ifcopenshell.api.owner.settings.get_application = old_get_application
@@ -5,18 +5,23 @@ import ifcopenshell.api
class TestEditAddress(test.bootstrap.IFC4):
def test_editing_a_postal_address(self):
address = self.file.createIfcPostalAddress()
ifcopenshell.api.run("owner.edit_address", self.file, address=address, attributes={
"Purpose": "OFFICE",
"Description": "Description",
"UserDefinedPurpose": "UserDefinedPurpose",
"InternalLocation": "InternalLocation",
"AddressLines": ["Address", "Lines"],
"PostalBox": "PostalBox",
"Town": "Town",
"Region": "Region",
"PostalCode": "PostalCode",
"Country": "Country",
})
ifcopenshell.api.run(
"owner.edit_address",
self.file,
address=address,
attributes={
"Purpose": "OFFICE",
"Description": "Description",
"UserDefinedPurpose": "UserDefinedPurpose",
"InternalLocation": "InternalLocation",
"AddressLines": ["Address", "Lines"],
"PostalBox": "PostalBox",
"Town": "Town",
"Region": "Region",
"PostalCode": "PostalCode",
"Country": "Country",
},
)
assert address.Purpose == "OFFICE"
assert address.Description == "Description"
assert address.UserDefinedPurpose == "UserDefinedPurpose"
@@ -30,17 +35,22 @@ class TestEditAddress(test.bootstrap.IFC4):
def test_editing_a_telecom_address(self):
address = self.file.createIfcTelecomAddress()
ifcopenshell.api.run("owner.edit_address", self.file, address=address, attributes={
"Purpose": "OFFICE",
"Description": "Description",
"UserDefinedPurpose": "UserDefinedPurpose",
"TelephoneNumbers": ["Telephone", "Numbers"],
"FacsimileNumbers": ["Facsimile", "Numbers"],
"PagerNumber": "PagerNumber",
"ElectronicMailAddresses": ["Electronic", "Mail", "Addresses"],
"WWWHomePageURL": "WWWHomePageURL",
"MessagingIDs": ["Messaging", "IDs"],
})
ifcopenshell.api.run(
"owner.edit_address",
self.file,
address=address,
attributes={
"Purpose": "OFFICE",
"Description": "Description",
"UserDefinedPurpose": "UserDefinedPurpose",
"TelephoneNumbers": ["Telephone", "Numbers"],
"FacsimileNumbers": ["Facsimile", "Numbers"],
"PagerNumber": "PagerNumber",
"ElectronicMailAddresses": ["Electronic", "Mail", "Addresses"],
"WWWHomePageURL": "WWWHomePageURL",
"MessagingIDs": ["Messaging", "IDs"],
},
)
assert address.Purpose == "OFFICE"
assert address.Description == "Description"
assert address.UserDefinedPurpose == "UserDefinedPurpose"
@@ -5,11 +5,16 @@ import ifcopenshell.api
class TestEditOrganisation(test.bootstrap.IFC4):
def test_editing_a_organisation(self):
organisation = self.file.createIfcOrganization()
ifcopenshell.api.run("owner.edit_organisation", self.file, organisation=organisation, attributes={
"Identification": "Identification",
"Name": "Name",
"Description": "Description",
})
ifcopenshell.api.run(
"owner.edit_organisation",
self.file,
organisation=organisation,
attributes={
"Identification": "Identification",
"Name": "Name",
"Description": "Description",
},
)
assert organisation.Identification == "Identification"
assert organisation.Name == "Name"
assert organisation.Description == "Description"
@@ -5,14 +5,19 @@ import ifcopenshell.api
class TestEditPerson(test.bootstrap.IFC4):
def test_editing_a_person(self):
person = self.file.createIfcPerson()
ifcopenshell.api.run("owner.edit_person", self.file, person=person, attributes={
"Identification": "Identification",
"FamilyName": "FamilyName",
"GivenName": "GivenName",
"MiddleNames": ["Middle", "Names"],
"PrefixTitles": ["Prefix", "Titles"],
"SuffixTitles": ["Suffix", "Titles"],
})
ifcopenshell.api.run(
"owner.edit_person",
self.file,
person=person,
attributes={
"Identification": "Identification",
"FamilyName": "FamilyName",
"GivenName": "GivenName",
"MiddleNames": ["Middle", "Names"],
"PrefixTitles": ["Prefix", "Titles"],
"SuffixTitles": ["Suffix", "Titles"],
},
)
assert person.Identification == "Identification"
assert person.FamilyName == "FamilyName"
assert person.GivenName == "GivenName"
@@ -5,11 +5,12 @@ import ifcopenshell.api
class TestEditRole(test.bootstrap.IFC4):
def test_editing_a_role(self):
role = self.file.createIfcActorRole()
ifcopenshell.api.run("owner.edit_role", self.file, role=role, attributes={
"Role": "ARCHITECT",
"UserDefinedRole": "UserDefinedRole",
"Description": "Description"
})
ifcopenshell.api.run(
"owner.edit_role",
self.file,
role=role,
attributes={"Role": "ARCHITECT", "UserDefinedRole": "UserDefinedRole", "Description": "Description"},
)
assert role.Role == "ARCHITECT"
assert role.UserDefinedRole == "UserDefinedRole"
assert role.Description == "Description"
@@ -10,8 +10,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
user = self.file.createIfcPersonAndOrganization()
application = self.file.createIfcApplication()
ifcopenshell.api.owner.settings.get_user = lambda x : user
ifcopenshell.api.owner.settings.get_application = lambda x : application
ifcopenshell.api.owner.settings.get_user = lambda x: user
ifcopenshell.api.owner.settings.get_application = lambda x: application
element = self.file.createIfcWall()
history = ifcopenshell.api.run("owner.update_owner_history", self.file, element=element)
@@ -31,8 +31,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
user = self.file.createIfcPersonAndOrganization()
application = self.file.createIfcApplication()
ifcopenshell.api.owner.settings.get_user = lambda x : user
ifcopenshell.api.owner.settings.get_application = lambda x : application
ifcopenshell.api.owner.settings.get_user = lambda x: user
ifcopenshell.api.owner.settings.get_application = lambda x: application
element = self.file.createIfcWall()
old_history = ifcopenshell.api.run("owner.create_owner_history", self.file)
@@ -55,8 +55,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
user = self.file.createIfcPersonAndOrganization()
application = self.file.createIfcApplication()
ifcopenshell.api.owner.settings.get_user = lambda x : user
ifcopenshell.api.owner.settings.get_application = lambda x : application
ifcopenshell.api.owner.settings.get_user = lambda x: user
ifcopenshell.api.owner.settings.get_application = lambda x: application
element = self.file.createIfcWall()
element2 = self.file.createIfcWall()