Skip to content

Commit 5e5ca7e

Browse files
committed
Added a test to make sure the embedded python methods' complexities are correct (per radon)
1 parent cc3700d commit 5e5ca7e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/testing/unit_tests/UnitTest/TestCoverage/Unit/TestComplexity.cls

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Method TestMethodsInThisClass()
1010
Do $$$AssertStatusOK($System.OBJ.Compile($classname(),"ck-d"))
1111
Do $$$AssertStatusOK(##class(TestCoverage.Data.CodeUnit).GetCurrentByName(tClass_".1.INT"))
1212
If $$$AssertStatusOK(##class(TestCoverage.Data.CodeUnit).GetCurrentByName(tClass_".CLS",,.tCodeUnit)) {
13+
Do $$$AssertStatusOK(##class(TestCoverage.Data.CodeUnit).GetCurrentByName(tClass_".PY",,.tPyCodeUnit))
14+
Do tCodeUnit.UpdatePyExecutableLines(tClass, .tPyCodeUnit)
1315
Set tKey = ""
1416
For {
1517
#dim tMethod As TestCoverage.Data.CodeSubUnit.Method
@@ -243,5 +245,13 @@ Method MethodWithComplexMacros(pStatus As %Status)
243245
$$$ThrowOnError(pStatus)
244246
}
245247

248+
/// Complexity: 3 (1 + for + if)
249+
ClassMethod ForLoopPython() [ Language = python ]
250+
{
251+
for i in range(5):
252+
if i > 4:
253+
continue
254+
return 1
246255
}
247256

257+
}

0 commit comments

Comments
 (0)