Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:47:24

0001 import pytest
0002 
0003 import acts
0004 
0005 
0006 def test_version():
0007     assert hasattr(acts, "__version__")
0008     assert hasattr(acts, "version")
0009     assert hasattr(acts.version, "major")
0010     assert hasattr(acts.version, "minor")
0011     assert hasattr(acts.version, "patch")
0012     assert hasattr(acts.version, "commit_hash")
0013     assert hasattr(acts.version, "commit_hash_short")
0014 
0015 
0016 def test_logging():
0017     for l in ("VERBOSE", "DEBUG", "INFO", "WARNING", "ERROR", "FATAL"):
0018         assert hasattr(acts.logging, l)
0019         assert hasattr(acts.logging.Level, l)
0020 
0021 
0022 def test_pgd_particle():
0023     assert len(acts.PdgParticle.__members__) == 32
0024 
0025 
0026 def test_algebra():
0027     v3 = acts.Vector3(1, 2, 3)
0028     with pytest.raises(TypeError):
0029         acts.Vector3(1, 2, 3, 4)
0030     with pytest.raises(TypeError):
0031         acts.Vector3(1, 2)
0032 
0033     v3 = acts.Vector3([1, 2, 3])
0034     with pytest.raises(TypeError):
0035         acts.Vector3([1, 2, 3, 4])
0036     with pytest.raises(TypeError):
0037         acts.Vector3([1, 2])
0038     with pytest.raises(TypeError):
0039         acts.Vector3()
0040 
0041     v4 = acts.Vector4(1, 2, 3, 4)
0042     with pytest.raises(TypeError):
0043         v4 = acts.Vector4(1, 2, 3)
0044     v4 = acts.Vector4([1, 2, 3, 4])
0045     with pytest.raises(TypeError):
0046         acts.Vector4([1, 2, 3])
0047     with pytest.raises(TypeError):
0048         acts.Vector4()
0049 
0050 
0051 def test_geometry_context_factory():
0052     """Test that GeometryContext factory method works without warnings"""
0053     import warnings
0054 
0055     # New factory method should not produce warnings
0056     with warnings.catch_warnings():
0057         warnings.simplefilter("error", DeprecationWarning)
0058         gctx = acts.GeometryContext.dangerouslyDefaultConstruct()
0059         assert gctx is not None
0060 
0061 
0062 def test_geometry_context_deprecated_constructor():
0063     """Test that GeometryContext default constructor produces deprecation warning"""
0064     # Old constructor should produce a deprecation warning
0065     with pytest.warns(DeprecationWarning, match="GeometryContext.*deprecated"):
0066         gctx = acts.GeometryContext()
0067         assert gctx is not None