mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 03:33:48 +00:00
Fix RUF015 (next() instead of list comprehensions[0])
https://docs.astral.sh/ruff/rules/-iterable-allocation-for-first-element/
This commit is contained in:
@@ -177,9 +177,9 @@ class TestRemoveRelation(NewFile):
|
||||
def test_run(self):
|
||||
TestAddRelation().test_run()
|
||||
assert BrickStore.graph
|
||||
source, relation, destination = list(
|
||||
BrickStore.graph.triples((None, URIRef("https://brickschema.org/schema/Brick#feeds"), None))
|
||||
)[0]
|
||||
source, relation, destination = next(
|
||||
iter(BrickStore.graph.triples((None, URIRef("https://brickschema.org/schema/Brick#feeds"), None)))
|
||||
)
|
||||
subject.remove_relation(source, relation, destination)
|
||||
assert not list(
|
||||
BrickStore.graph.triples(
|
||||
|
||||
@@ -55,7 +55,7 @@ class TestAddClassificationReferenceFromBSDD(NewFile):
|
||||
bpy.ops.bim.add_classification_reference_from_bsdd(obj="IfcSpace/Cube", obj_type="Object")
|
||||
refs = ifcopenshell.util.classification.get_references(element)
|
||||
assert len(refs) == 1
|
||||
assert list(refs)[0].Location.startswith(uri)
|
||||
assert next(iter(refs)).Location.startswith(uri)
|
||||
|
||||
def test_add_classification_refence_with_props(self):
|
||||
bpy.ops.bim.create_project()
|
||||
@@ -92,7 +92,7 @@ class TestAddClassificationReferenceFromBSDD(NewFile):
|
||||
assert pset and pset["Handicap Accessible"] == True
|
||||
refs = ifcopenshell.util.classification.get_references(element)
|
||||
assert len(refs) == 1
|
||||
assert list(refs)[0].Location.startswith(uri)
|
||||
assert next(iter(refs)).Location.startswith(uri)
|
||||
|
||||
def test_add_clasification_reference_with_object_type(self):
|
||||
bpy.ops.bim.create_project()
|
||||
|
||||
@@ -106,7 +106,7 @@ class TestGetManualBooleans(NewFile):
|
||||
assert set(subject.get_booleans(element, representation)) == set(bools)
|
||||
assert len(subject.get_manual_booleans(element, representation)) == 0
|
||||
|
||||
bool1 = list(bools)[0]
|
||||
bool1 = bools[0]
|
||||
|
||||
subject.mark_manual_booleans(element, [bool1])
|
||||
assert set(subject.get_manual_booleans(element, representation)) == {bool1}
|
||||
|
||||
Reference in New Issue
Block a user