-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #300 from buildingSMART/IVS-137-ALB012-IfcAlignmen…
…tVerticalSegment.RadiusOfCurvature IVS-137 ALB012 Vertical Segment Radius of Curvature
- Loading branch information
Showing
16 changed files
with
1,843 additions
and
75 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
features/ALB012_Alignment-vertical-segment-radius-of-curvature.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@implementer-agreement | ||
@ALB | ||
@version1 | ||
@E00020 | ||
Feature: ALB012 - Alignment vertical segment radius of curvature | ||
The rule verifies the 'RadiusOfCurvature' design parameter for vertical alignment segments. | ||
|
||
Background: | ||
Given A model with Schema "IFC4.3" | ||
Given An IfcAlignmentVertical | ||
Given A relationship IfcRelNests from IfcAlignmentVertical to IfcAlignmentSegment and following that | ||
Given Its attribute DesignParameters | ||
Given Its entity type is 'IfcAlignmentVerticalSegment' | ||
|
||
Scenario: Validating the absence of curvature radius for specific predefined types of vertical segment | ||
Given PredefinedType != 'ARC' or 'PARABOLICARC' | ||
Then The value of attribute RadiusOfCurvature must be empty | ||
|
||
Scenario: Validating the radius of curvature for parabolic segments | ||
Given PredefinedType = 'PARABOLICARC' | ||
Then The value of attribute RadiusOfCurvature must be equal to the expression: HorizontalLength / ( EndGradient - StartGradient ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import os | ||
from dataclasses import dataclass, asdict | ||
import json | ||
|
||
@dataclass | ||
class ExceptionSummary: | ||
""" | ||
Custom exception for summarizing internal errors during feature validation. | ||
The exception is forwarded to the JSON output and later evaluated after the Behave run using pytest. | ||
Errors occurring at any stage of the step implementation or while running the custom decorator are captured by this exception. | ||
""" | ||
feature: str | ||
step: str | ||
error_type: str | ||
location: str | ||
|
||
@staticmethod | ||
def extract_traceback_summary(exc_traceback): | ||
trace = {} | ||
|
||
current_tb = exc_traceback | ||
while current_tb is not None: | ||
filename = os.path.basename(current_tb.tb_frame.f_code.co_filename) | ||
line_number = current_tb.tb_lineno | ||
|
||
if filename not in trace: | ||
trace[filename] = [line_number] | ||
elif line_number not in trace[filename]: | ||
trace[filename].append(line_number) | ||
|
||
current_tb = current_tb.tb_next | ||
|
||
trace_list = [] | ||
for filename in reversed(trace): | ||
line_numbers = ", ".join(f"#{ln}" for ln in trace[filename]) | ||
trace_list.append(f"{filename}(l{line_numbers})") | ||
|
||
|
||
return ", ".join(trace_list) | ||
|
||
@classmethod | ||
def from_context(cls, context): | ||
feature_name = context.feature.name | ||
step_name = context.step.name | ||
error_type = str(context.step.exception.__class__.__name__) | ||
location = cls.extract_traceback_summary(context.step.exc_traceback) | ||
|
||
return cls(feature=feature_name, step=step_name, error_type=error_type, location=location) | ||
|
||
def to_dict(self): | ||
return asdict(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.