File: test_template_err.py

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (54 lines) | stat: -rw-r--r-- 930 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from neuron import h
from neuron.expect_hocerr import expect_err


def test_template_err():
    h(
        """
begintemplate TestTemplateErr1
proc init() {
    create soma
}
endtemplate TestTemplateErr1
    """
    )

    expect_err("m = h.TestTemplateErr1()")

    h(
        """
begintemplate TestTemplateErr2
proc init() {
}
proc setfoo() {
    foo = 5 // 0 default if not called instead of UNDEF
}
endtemplate TestTemplateErr2
    """
    )

    m = h.TestTemplateErr2()
    expect_err('h.execute("create foo", m)')
    assert m.foo == 0.0


def test_template_err2():
    h(
        """
proc test_template_err2() {
    create test_template_err_sec
}
    """
    )
    h.test_template_err2()
    s = h.test_template_err_sec
    s.nseg = 3
    s.insert("hh")
    h.topology()
    print(s.psection())
    h.delete_section(sec=h.test_template_err_sec)


if __name__ == "__main__":
    test_template_err()
    test_template_err2()