Coverage for backend/flowsheetInternals/unitops/methods/add_expression.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-11-06 23:27 +0000

1from common.config_types import PropertyType as PropertyTypeObj 

2from typing import TYPE_CHECKING 

3if TYPE_CHECKING: 

4 from flowsheetInternals.unitops.models import SimulationObject 

5 from core.auxiliary.models.PropertyInfo import PropertyInfo 

6 

7 

8 

9def add_expression(simulation_object: "SimulationObject") -> "PropertyInfo": 

10 property_set = simulation_object.properties 

11 number = property_set.containedProperties.count() + 1 

12 # display name: "Expression #"" 

13 prop = PropertyTypeObj( 

14 displayName=f"Expression {number}", 

15 value="", 

16 unitType="dimensionless", 

17 type="text", 

18 ) 

19 fields = get_property_fields(f"expression{number}", prop, property_set) 

20 prop_info = PropertyInfo.create_save(**fields, flowsheet=simulation_object.flowsheet) 

21 return prop_info 

22 

23from core.auxiliary.models.PropertyInfo import PropertyInfo 

24from flowsheetInternals.unitops.models import SimulationObject 

25from flowsheetInternals.unitops.config.config_methods import get_property_fields 

26