Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-05 08:18:37

0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 import pytest
0010 
0011 import detray.core
0012 import detray.tests
0013 
0014 
0015 def test_material_scan_config():
0016     cfg = detray.tests.MaterialScanConfig()
0017     cfg.trackGenerator.etaSteps = 9
0018     assert cfg.trackGenerator.etaSteps == 9
0019 
0020 
0021 def test_material_validation_config():
0022     cfg = detray.tests.MaterialValidationConfig()
0023     cfg.materialFile = "navigation_output"
0024     cfg.nTracks = 42
0025     cfg.propagation.stepping.pathLimit = 1234.0
0026 
0027     assert cfg.materialFile == "navigation_output"
0028     assert cfg.nTracks == 42
0029     assert cfg.propagation.stepping.pathLimit == pytest.approx(1234.0, rel=1e-6)
0030 
0031 
0032 def test_name_map():
0033     names = detray.core.NameMap()
0034     names[0] = "volume_0"
0035 
0036     assert names[0] == "volume_0"
0037     assert names["volume_0"] == 0
0038     assert 0 in names
0039     assert "volume_0" in names
0040     with pytest.raises(KeyError):
0041         names[99]
0042     with pytest.raises(KeyError):
0043         names["does_not_exist"]