CEXT-Dan / PyRx

Python for AutoCAD
42 stars 7 forks source link

Unit test error BCAD v24, UnitTestPyBcadCivil #9

Closed schoeller closed 5 months ago

schoeller commented 6 months ago

Dear all,

thanks for the courageous work. When running the unit test on BCAD I receive the following error.

<unittest.runner.TextTestResult run=1 errors=0 failures=0>
TestBricsCADCivil
======================================================================
FAIL: test_BsysCvDbAlignment_cast (UnitTestPyBcadCivil.TestBCadCivil.test_BsysCvDbAlignment_cast)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\temp/PyRx-1.2.1/PyRx-1.2.1/unit tests\UnitTestPyBcadCivil.py", line 56, in test_BsysCvDbAlignment_cast
    self.assertNotEqual(line.length(), 0)
AssertionError: 0.0 == 0

Best regards

Sebastian

CEXT-Dan commented 5 months ago

Hi Sebastian,

This is passing for me, but I see that the test has issues, I’ll be working on this

test

CEXT-Dan commented 5 months ago

Hi, can you re check this? I've modified the test, it should test of the length is greater than zero, in case it was a tolerance issue

schoeller commented 5 months ago

Pulled from origin PyRx version <1.2.007.20240329>. Unittest is not working. Handle AE exist. To check on length I modified test to

        for id in hAlignment.getUnorderedElementIds():
            element : Cv.CvDbHAlignmentElement = hAlignment.elementAtId(id)
            self.assertFalse(element.isNullObj())
            if Cv.HAlignmentElementType.eLine == element.type():
                line: Cv.CvDbHAlignmentLine = Cv.CvDbHAlignmentLine.cast(element)
                print(line.length())
                # self.assertGreater(line.length(), 0)
                # flag = line.isA().isDerivedFrom(Cv.CvDbHAlignmentLine.desc())
                # self.assertTrue(flag)
            elif Cv.HAlignmentElementType.eSpiralCurveSpiral == element.type():
                spiral : Cv.CvDbHAlignmentSCS = Cv.CvDbHAlignmentSCS.cast(element)
                print(spiral.length())
                # self.assertGreater(spiral.length(), 0)
                # flag = spiral.isA().isDerivedFrom(Cv.CvDbHAlignmentSCS.desc())
                # self.assertTrue(flag)

Results as follows.

BCAD 24.1.08 German :

: PYBCCIVILTEST
TestBricsCADCivil
0.0
0.0
0.0
----------------------------------------------------------------------
Ran 4 tests in 0.029s

OK

BCAD 24.2.03, English

: PYBCCIVILTEST
TestBricsCADCivil
8.07413485431498
5.000049808605995
10.000049808605997
----------------------------------------------------------------------
Ran 4 tests in 0.025s

OK

Will try next BCAD 24.1.8 English version.

CEXT-Dan commented 5 months ago

Oh, if that’s the case it’s a bug in BricsCAD!

schoeller commented 5 months ago

I have create a report with SR175196.

schoeller commented 5 months ago

I confirm it has been fixed in BCAD 24.2.03

All test pass