|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# |
| 3 | +# test_issue_888.py |
| 4 | +# |
| 5 | +# This file is part of NEST. |
| 6 | +# |
| 7 | +# Copyright (C) 2004 The NEST Initiative |
| 8 | +# |
| 9 | +# NEST is free software: you can redistribute it and/or modify |
| 10 | +# it under the terms of the GNU General Public License as published by |
| 11 | +# the Free Software Foundation, either version 2 of the License, or |
| 12 | +# (at your option) any later version. |
| 13 | +# |
| 14 | +# NEST is distributed in the hope that it will be useful, |
| 15 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | +# GNU General Public License for more details. |
| 18 | +# |
| 19 | +# You should have received a copy of the GNU General Public License |
| 20 | +# along with NEST. If not, see <http://www.gnu.org/licenses/>. |
| 21 | + |
| 22 | +import nest |
| 23 | +import pytest |
| 24 | + |
| 25 | + |
| 26 | +def test_issue_888(): |
| 27 | + """ |
| 28 | + Ensure that the resolution is set as a multiple of tics. |
| 29 | +
|
| 30 | + This test verifies that setting the resolution without specifying the tics per ms |
| 31 | + results in an error. It also checks that setting both the resolution and tics per ms |
| 32 | + to incompatible values results in an error. |
| 33 | +
|
| 34 | + Author: Håkon Mørk, 2018-03-05 |
| 35 | + """ |
| 36 | + |
| 37 | + # Only setting resolution should fail |
| 38 | + with pytest.raises(Exception): |
| 39 | + nest.ResetKernel() |
| 40 | + nest.SetKernelStatus({"resolution": 0.03125}) |
| 41 | + |
| 42 | + # Setting both resolution and tics per ms to incompatible values should fail |
| 43 | + with pytest.raises(Exception): |
| 44 | + nest.ResetKernel() |
| 45 | + nest.SetKernelStatus({"tics_per_ms": 1000.0, "resolution": 0.03125}) |
0 commit comments