woo.tests

All defined functionality tests for woo.

woo.tests.testAll(sysExit=False)[source]

Run all tests defined in all woo.tests.* modules. Return TestResult object for further examination. If sysExit is true, call sys.exit with status 0 (all tests passed), 1 (some tests failed), 2 (an exception was raised).

woo.tests.testModule(module)[source]

Run all tests defined in the module specified, return TestResult object (http://docs.python.org/library/unittest.html#unittest.TextTestResult) for further processing.

@param module: fully-qualified module name, e.g. woo.tests.core

woo.tests.core

Inheritance diagram of woo.tests.core

Core functionality (Scene in c++), such as accessing bodies, materials, interactions. Specific functionality tests should go to engines.py or elsewhere, not here.

class woo.tests.core.TestArrayAccu(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testPreserveResize()[source]

OpenMP array accu: preserve old data on resize

testResize()[source]

OpenMP array accu: resizing

testThreadWrite()[source]

OpenMP array accu: concurrent writes

class woo.tests.core.TestContact(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testForceSign()[source]

Contact: forceSign

class woo.tests.core.TestForce(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

class woo.tests.core.TestIO(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testSaveAllClasses()[source]

I/O: All classes can be saved and loaded with boost::serialization

class woo.tests.core.TestInteractions(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

class woo.tests.core.TestLoop(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testDead()[source]

Loop: dead engines are not run

testEnginesModificationInsideLoop()[source]

Loop: Scene.engines can be modified inside the loop transparently.

testNoneEngine()[source]

Loop: None engine raises exception.

testPausedContext()[source]

Loop: “with Scene.paused()” context manager

testStopAtHook()[source]

Loop: S.stopAtHook

testStopAtStep()[source]

Loop: S.stopAtStep and S.run(steps=…)

testStopAtTime()[source]

Loop: S.stopAtTime and S.run(time=…)

testSubstepping()[source]

Loop: substepping

testWait()[source]

Loop: Scene.wait() returns only after the current step finished

testWaitForScenes()[source]

Loop: Master.waitForScenes correctly handles reassignment of the master scene

class woo.tests.core.TestObjectInstantiation(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testBits()[source]

Core: AttrTrait.bits accessors

testClassCtors()[source]

Core: correct types are instantiated

testContactLoopCtor()[source]

Core: ContactLoop special ctor

testDeepcopy()[source]

Core: Object.deepcopy

testDeprecated()[source]

Core: AttrTrait.deprecated raises exception on access

testDispatcherCtor()[source]

Core: dispatcher ctors with functors

testHidden()[source]

Core: Attr::hidden

testHidden_static()[source]

Core: Attr::hidden (static)

testInvalidAttr()[source]

Core: invalid attribute access raises AttributeError

testNamedEnum()[source]

Core: Attr::namedEnum

testNamedEnum_static()[source]

Core: Attr::namedEnum (static)

testNoSave()[source]

Core: Attr::noSave

testNoSave_static()[source]

Core: Attr::noSave (static)

testNodeDataCtorAssign()[source]

Core: assign node data using shorthands in the ctor

testNotifyDead()[source]

Core: PeriodicEngine::notifyDead

testParallelEngineCtor()[source]

Core: ParallelEngine special ctor

testReadonly()[source]

Core: Attr::readonly

testReaonly_static()[source]

Core: Attr::readonly (static)

testRootDerivedCtors_attrs_few()[source]

Core: class ctor’s attributes

testShared()[source]

Core: shared_ptr really shared

testSharedAfterReload()[source]

Core: shared_ptr preserved when saving/loading

testTriggerPostLoad()[source]

Core: postLoad & Attr::triggerPostLoad

testUnicodeStrConverter()[source]

Core: std::string attributes can be assigned unicode string

testWrongFunctorType()[source]

Core: dispatcher and functor type mismatch is detected

class woo.tests.core.TestParticles(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testIterate()[source]

Particles: iteration

testLen()[source]

Particles: len(S.dem.par)

testNegativeIndex()[source]

Particles: negative index counts backwards (like python sequences).

testRemove()[source]

Particles: acessing removed particles raises IndexError

testRemoveShrink()[source]

Particles: removing particles shrinks storage size

testRemovedIterate()[source]

Particles: iterator silently skips erased particles

class woo.tests.core.TestPyDerived(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testBoostDumpError()[source]

PyDerived: refuses to dump with boost::serialization format (data loss)

testBoostSaveError()[source]

PyDerived: refuses to save via Object::save (data loss; dump must be used instead)

testDeprecated()[source]

PyDerived: deprecated attribute raises ValueError on access

testIniDefault()[source]

PyDerived: default initialization

testIniUser()[source]

PyDerived: user initialization (python parent)

testPickle()[source]

PyDerived: deepcopy

testPickle2()[source]

PyDerived: deepcopy (python parent)

testStrValidation()[source]

PyDerived: string choice is validated

testTraits()[source]

PyDerived: PyAttrTraits

testTrigger()[source]

PyDerived: postLoad trigger (python parent)

testTypeCoerceCtor()[source]

PyDerived: type coercion (ctor)

testTypeCoerceFloats()[source]

PyDerived: type coercion (primitive types)

testTypeCoerceObject()[source]

PyDerived: type coercion (woo.core.Object)

woo = <module 'woo' from '/home/eudoxos/.local/lib/python3.8/site-packages/woo/__init__.py'>
class woo.tests.core.TestScene(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class woo.tests.core.TestTags(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_TestPyClass

Object_TestPyClass

digraph _TestPyClass {
        rankdir=LR;
        margin=.2;
        "_TestPyClass" [shape="box",fontsize=8,style="setlinewidth(0.5),solid",height=0.2,URL="woo.tests.html#woo.tests.core._TestPyClass"];
        "_TestPyClass2" [shape="box",fontsize=8,style="setlinewidth(0.5),solid",height=0.2,URL="woo.tests.html#woo.tests.core._TestPyClass"];
        "_TestPyClass" -> "_TestPyClass2" [arrowsize=0.5,style="setlinewidth(0.5)"]
}
class woo.tests.core._TestPyClass(self: woo.core.Object)None[source]

Sample pure-python class integrated into woo (mainly used with preprocessors), for use with TestPyDerived.

[py/tests/core.py]

aF(= 1.0)

float attr

[type: float]

aFF(= [0.0, 1.0, 2.0])

list of floats attr

[type: [float, …]]

aV2(= Vector2(0, 1))

vector2 attr

[type: Vector2]

aVV2(= [Vector2(0,0), Vector2(1,1)])

list of vector2 attr

[type: [Vector2, …]]

aNode(= <Node @ 0x28d7a70, at (1, 1, 1)>)

node attr

[type: Node]

aNodeNone(= None)

node attr, uninitialized

[type: Node]

aNNode(= [<Node @ 0x26a4a20, at (1,1,1)>, <Node @ 0x2273800, at (2,2,2)>])

List of nodes

[type: [Node, …]]

aF_trigger(= 1.0)

Float triggering postLoad, copying its value to aF

[type: float]

postLoadCounter(= 0)

counter for postLoad (readonly). Incremented by 1 after construction, incremented by 10 when assigning to aF_trigger.

[type: int]

deprecAttr(= -1)

deprecated, here should be the explanation.

[type: int, not shown in the UI, not dumped, DEPRECATED, raises ValueError when accessed]

sChoice(= 'aa')

String choice attribute

[type: str, choices: aa, bb, cc]

PAT

alias of woo.pyderived.PyAttrTrait

static __new__(klass, **kw)[source]

Create and return a new object. See help(type) for accurate signature.

deepcopy(**kw)

The c++ dedepcopy uses boost::serialization, we need to use pickle. As long as deepcopy is called from python, this function gets precedence over the c++ one. Additional keyword parameters are used to immediately set parameters on the copy before returning.

_TestPyClass2

Object_TestPyClass_TestPyClass2

class woo.tests.core._TestPyClass2(self: woo.core.Object)None[source]

Python class deriving from python base class (which in turn derives from c++).

[py/tests/core.py]

f2(= 0)

Float attr in derived class

[type: int]

f2counter(= 0)

Count how many times was f2 manipulated (to test triggerPostLoad in class with python parent)

[type: int]

static __new__(klass, **kw)[source]

Create and return a new object. See help(type) for accurate signature.

deepcopy(**kw)

The c++ dedepcopy uses boost::serialization, we need to use pickle. As long as deepcopy is called from python, this function gets precedence over the c++ one. Additional keyword parameters are used to immediately set parameters on the copy before returning.

woo.tests.clustering

Tests for the new woo.dem.ClusterAnalysis.

class woo.tests.clustering.TestClusterAnalysis(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testZeroConnClustering()[source]

clustering: simple zero-connectivity clustering

woo.tests.clump

Various computations affected by the periodic boundary conditions.

class woo.tests.clump.TestSimpleClump(methodName='runTest')[source]

Test things on a simple clump composed of 2 spheres.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testConsistency()[source]

Clump: ids and flags consistency

testNoCollide()[source]

Clump: particles inside one clump don’t collide with each other

testStaticProperties()[source]

Clump: mass, centroid, intertia

testVelocity()[source]

Clump: velocities of member assigned by Leapfrog

class woo.tests.clump.TestSphereClumpGeom(methodName='runTest')[source]

Clump: geometry of clumps composed of spheres only

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testSampling()[source]

SphereClumpGeom: properties via grid sampling

testSteiner()[source]

SphereClumpGeom: properties via Steiner’s theorem

woo.tests.clump.sphereClumpPrincipalAxes(cc, rr)[source]

Clump: return vol,pos,ori,inertia of sphere clump defined by centers and radii of spheres

woo.tests.labels

class woo.tests.labels.TestSceneLabels(methodName='runTest')[source]

Test LabelMapper and related functionality.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testAccess()[source]

LabelMapper: access

testAutoLabel()[source]

LabelMapper: labeled engines are added automatically

testDel()[source]

LabelMapper: delete

testDir()[source]

LabelMapper: __dir__

testEngineLabels()[source]

LabelMapper: engine/functor labels (mix of older tests)

testGetattrIndexed()[source]

LabelMapper: getattr with index

testHasattr()[source]

LabelMapper: __hasattr__

testMixedSeq()[source]

LabelMapper: mixed sequences rejected, undetermined accepted

testOpaqueSeqWithWooObjs()[source]

LabelMapper: opaque sequence types with Woo objects are rejected

testPseudoModules()[source]

LabelMapper: pseudo-modules

testSeq()[source]

LabelMapper: sequences

testShared()[source]

LabelMapper: shared objects

testString()[source]

LabelMapper: strings and bytes

testWritable()[source]

woo.tests.pbc

Various computations affected by the periodic boundary conditions.

class woo.tests.pbc.TestPBC(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testDegenerate()[source]

PBC: degenerate cell raises exception

testHomotheticResizePos()[source]

PBC: homothetic cell deformation adjusts particle position (homoDeform==’pos’)

testHomotheticResizeVel()[source]

PBC: homothetic cell deformation adjusts particle velocity (homoDeform==’vel’)

testKineticEnergy()[source]

PBC: Particle.getEk considers only fluctuation velocity, not the velocity gradient (homoDeform==’vel2’)

testKineticEnergy_homoPos()[source]

PBC: Particle.Ekt considers only fluctuation velocity, not the velocity gradient (homoDeform==’pos’)

testL3GeomIncidentVelocity_homoPos()[source]

PBC: L6Geom incident velocity (homoDeform==’pos’)

testL6GeomIncidentVelocity()[source]

PBC: L6Geom incident velocity (homoDeform==’gradV2’)

testSetBox()[source]

PBC: setBox modifies hSize correctly

testTrsfChange()[source]

PBC: chaing trsf changes hSize0, but does not modify hSize

testVelGrad()[source]

PBC: velGrad changes hSize but not hSize0, accumulates in trsf (homoDeform=’vel2’)

class woo.tests.pbc.TestPBCCollisions(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testCrossBoundarySort()[source]

PBC: InsertionSortCollider correctly sorts on the boundary (bug #… discovered by Bruno)

testDoubleContact()[source]

PBC: InsertionSortCollider raises on double-contact of large particles accross the cell

testNormalContact()[source]

PBC: InsertionSortCollider computes collisions and cellDist correctly

testOverHalfContact()[source]

PBC: InsertionSortCollider handles particle spanning more than half cell-size

woo.tests.psd

Test particle generator, that the resulting PSD curve matches the one on input.

class woo.tests.psd.BiasedPositionTest(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testAxialBias()[source]

Inlet: axial bias

class woo.tests.psd.PsdSphereGeneratorTest(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

checkOk(relDeltaInt=0.02, relDeltaD=0.04)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

testClippingSpuriousPoints()[source]

PSD: clipping spurious values

testMassContinuous()[source]

PSD: continuous mass-based generator

testMassDiscrete()[source]

PSD: discrete mass-based generator

testMonodisperse()[source]

PSD: monodisperse packing

testNoDumpAttrs()[source]

PSD: ParticleGenerator.genDiamMassTime not dumped into expr/json

testNumContinuous()[source]

PSD: continuous number-based generator

testNumDiscrete()[source]

PSD: discrete number-based generator

testPsdTimeRange()[source]

PSD: time range for computing PSD

woo.tests.shapepack

class woo.tests.shapepack.TestShapePack(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

assertAlmostEqualRel(a, b, relerr, abserr=0)[source]
testFromSim()[source]

ShapePack: from/to simulation with particles

testGridSamping()[source]

ShapePack: grid samping gives good approximations of mass+inertia

testLineEndings()[source]

ShapePack: handle different line endings (LF, CR+LF, CR) gracefully

testLoadSampleTxt()[source]

ShapePack: load sample text file

testSingle()[source]

ShapePack: single particles not clumped when inserted into simulation

woo.tests.hertz

class woo.tests.hertz.TestHertz(methodName='runTest')[source]

Test Law2_L6Geom_HertzPhys_DMT.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testElasticCollisionTime()[source]

Hertz: elastic collision time for different impact velocities (simulation/analytic)

woo.tests.tetra

class woo.tests.tetra.TestTet4(methodName='runTest')[source]

Test woo.fem.Tet4.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testStiffnessMatrix()[source]

Tet4: stiffness matrix

woo.tests.io

Test loading and saving woo objects in various formats

class woo.tests.io.TestArraySerialization(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testBoostMultiArray()[source]

IO: serialization of boost::multi_array

testMatrixX()[source]

IO: serialization of arrays

class woo.tests.io.TestFormatsAndDetection(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testBin()[source]

IO: binary save/load & format detection

testBinGz()[source]

IO: binary save/load (gzip compressed) & format detection

testDeepcopy()[source]

IO: temporary store (Object.deepcopy)

testExpr()[source]

IO: expression dump/load & format detection (file+string)

testExprHashColonOverride()[source]

IO: special comments #% inside expr dumps

testExprSpecialComments()[source]

IO: special comments #: inside expr dumps

testHtml()[source]

IO: HTML dump (file+string)

testInvalidExtension()[source]

IO: unrecognized extension rejected with format=’auto’

testInvalidFormat()[source]

IO: invalid formats rejected

testJson()[source]

IO: JSON dump/load & format detection (file+string)

testPickle()[source]

IO: pickle dump/load & format detection (file+string)

testRefuseDerivedPyObject()[source]

IO: python-derived objects refuse to save via boost::serialization.

testStrFile()[source]

IO: file can be given as str

testTmpStore()[source]

IO: temporary store (loadTmp, saveTmp)

testUnicodeFile()[source]

IO: filename can be given as unicode

testXml()[source]

IO: XML save/load & format detection

testXmlBz2()[source]

IO: XML save/load (bzip2 compressed) & format detection

tryDumpLoad(fmt='auto', ext='', load=True)[source]
tryDumpLoadStr(fmt, load=True)[source]
class woo.tests.io.TestNoDumpAttributes(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testCond()[source]

IO: conditional dumping to expr and JSON

testUncond()[source]

IO: unconditional noDump attribute (template param)

class woo.tests.io.TestSpecialDumpMethods(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testSceneLastDump_direct()[source]

IO: Scene.lastSave set (Object._boostSave overridden)

woo.tests.ellipsoid

class woo.tests.ellipsoid.TestEllipsoid(methodName='runTest')[source]

Test Cg2_Ellipsoid_Ellipsoid_L6Geom.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testMassInertia()[source]

Ellipsoid: mass and inertia computation

testNormalDisplacementEllipsoid()[source]

Ellipsoid: normal displacement on contact with ellipsoid.

testNormalDisplacementWall()[source]

Ellipsoid: normal displacement on contact with wall

woo.tests.volumetric

class woo.tests.volumetric.TestVolumetric(methodName='runTest')[source]

Volumetric properties

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testTetraCanon()[source]

Tetra: mass, centrer, inertia of canonical tetrahedron

testTetraGeneric()[source]

Tetra: inertia and principal axes of generic tetrahedron

testTetraUnit()[source]

Tetra: principal axes of unit tetrahedron

testTriCanon()[source]

Triangle: area, inertia of canonical triangle

woo.tests.energy

Test some parts of energy conservation in DEM simulations.

class woo.tests.energy.TestInletsAndOutlets(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testConveyorInlet()[source]

Energy: conveyor inlet traces kinetic energy

testRandomInlet()[source]

Energy: random box factory traces kinetic energy

class woo.tests.energy.TestLeapfrog(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testDampingSkip()[source]

Energy: DemData.dampingSkip

testGravitySkip()[source]

Energy: DemData.gravitySkip

woo.tests.batch

class woo.tests.batch.TestBatchResults(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testHdf5()[source]

Batch: results in HDF5 (store/read/XLS(X)/CSV)

woo.tests.grid

class woo.tests.grid.TestGridColliderBasics(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testParams()[source]

GridCollider: used-definable parameters

class woo.tests.grid.TestGridStore(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testAppend()[source]

Grid: storage: appending data

testComplement()[source]

Grid: storage: complements

testEx()[source]

Grid: storage: dense and extra data

testPyAcces()[source]

Grid: storage: python access

testStorageOrder()[source]

Grid: storage: storage order

woo.tests.demfield

Test loading and saving woo objects in various formats

class woo.tests.demfield.TestContactLoop(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testUpdatePhys()[source]

DEM: ContactLoop.updatePhys: never, always, once

class woo.tests.demfield.TestDemField(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testGuessMoving()[source]

DEM: correctly guess that Node.dem needs motion integration

class woo.tests.demfield.TestImpose(methodName='runTest')[source]

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

testCombinedImpose()[source]

DEM: CombinedImpose created from Impose()+Impose()

testCombinedImposeFunction()[source]

DEM: CombinedImpose combines impositions

testInterpolatedMotion()[source]

DEM: InterpolatedMotion computes correct position and rotation

testUselessRotationImpose()[source]

DEM: selfTest error when imposing rotation on aspherical particles (would have no effect)

testVariableVelocity3d_rot()[source]

DEM: VariableVelocity3d imposition (angular velocity)

Tip

Report issues or inclarities to github.