From 29594b50b5bbc0489be5e49f9d9e1218027fb2e7 Mon Sep 17 00:00:00 2001 From: Vukas Pajic <83825269+vulevukusej@users.noreply.github.com> Date: Wed, 20 Jul 2022 09:06:04 +0200 Subject: [PATCH] test when value does not exist --- src/ifcopenshell-python/test/util/test_selector.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ifcopenshell-python/test/util/test_selector.py b/src/ifcopenshell-python/test/util/test_selector.py index 2016be15cf..ccbf60b443 100644 --- a/src/ifcopenshell-python/test/util/test_selector.py +++ b/src/ifcopenshell-python/test/util/test_selector.py @@ -111,6 +111,16 @@ class TestSelector(test.bootstrap.IFC4): assert subject.Selector.parse(self.file, '.IfcElement[Name*="Foo"]') == [element] assert subject.Selector.parse(self.file, '.IfcElement[Name*="oba"]') == [element] assert subject.Selector.parse(self.file, '.IfcElement[Name*="abc"]') == [] + + def test_comparing_if_value_does_not_exist(self): + element_1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") + element_2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") + pset_1 = ifcopenshell.api.run("pset.add_pset", self.file, product=element_1, name="Foo_Bar") + pset_2 = ifcopenshell.api.run("pset.add_pset", self.file, product=element_2, name="Foo_Bar") + ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset_1, properties={"Foo": "Bar"}) + ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset_2, properties={"Foo": "BOO"}) + assert subject.Selector.parse(self.file, '.IfcElement[Foo_Bar.Foo != "Bar"]') == [element_2] + assert subject.Selector.parse(self.file, '.IfcElement[Foo_Bar.Foo != "BOO"]') == [element_1] def test_selecting_a_property_which_includes_non_standard_characters(self): element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")