MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / testBoxxArray

Function testBoxxArray

src/python/PyImathTest/pyImathTest.py:9276–9329  ·  view source on GitHub ↗
(Array, Box, Vec)

Source from the content-addressed store, hash-verified

9274# -------------------------------------------------------------------------
9275# Tests BoxxArrays
9276def testBoxxArray(Array, Box, Vec):
9277
9278 b0 = Box(Vec(1), Vec(2))
9279 b1 = Box(Vec(2), Vec(3))
9280 b2 = Box(Vec(3), Vec(4))
9281
9282 a = Array (3)
9283
9284 a[0] = b0
9285 a[1] = b1
9286 a[2] = b2
9287
9288 assert a[0] == b0
9289 assert a[1] == b1
9290 assert a[2] == b2
9291
9292 # Element setting.
9293
9294 a = Array(2)
9295
9296 try:
9297 a[-3] = b0 # This should raise an exception.
9298 except:
9299 pass
9300 else:
9301 assert 0 # We shouldn't get here.
9302
9303 try:
9304 a[3] = b0 # This should raise an exception.
9305 except:
9306 pass
9307 else:
9308 assert 0 # We shouldn't get here.
9309
9310 try:
9311 a[1] = "a" # This should raise an exception.
9312 except:
9313 pass
9314 else:
9315 assert 0 # We shouldn't get here.
9316
9317 # Assignment.
9318
9319 a = Array(2)
9320 a[0] = b0
9321 a[1] = b1
9322
9323 # Comparison.
9324
9325 a1 = Array(b2, 3)
9326 a2 = Array(b2, 3)
9327
9328 testVectorVectorComparisonOps(a1, a2)
9329 testVectorScalarComparisonOps(a1, b2)
9330
9331def testBoxArray ():
9332 print ("Box2iArray")

Callers 1

testBoxArrayFunction · 0.70

Calls 3

BoxClass · 0.85

Tested by

no test coverage detected