1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """Tests for C{hasPQcap}.
18 """
19
20 from numpy import array
21
22 from pypower.hasPQcap import hasPQcap
23
24 from pypower.t.t_begin import t_begin
25 from pypower.t.t_is import t_is
26 from pypower.t.t_end import t_end
27
28
30 """Tests for C{hasPQcap}.
31
32 @author: Ray Zimmerman (PSERC Cornell)
33 @author: Richard Lincoln
34 """
35 t_begin(4, quiet)
36
37
38
39 gen = array([
40 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
41 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, 0, 12, 0, 2, 0, 0, 0, 0, 0],
42 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -15, 12, -15, 2, 0, 0, 0, 0, 0],
43 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 0, -2, 0, 0, 0, 0, 0, 0],
44 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 15, -2, 15, 0, 0, 0, 0, 0],
45 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 12, -2, 2, 0, 0, 0, 0, 0],
46 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, 0, 12, 0, 8, 0, 0, 0, 0, 0],
47 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -15, 12, -15, 8, 0, 0, 0, 0, 0],
48 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 0, -8, 0, 0, 0, 0, 0, 0],
49 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 15, -8, 15, 0, 0, 0, 0, 0],
50 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 12, -8, 8, 0, 0, 0, 0, 0]
51 ])
52
53 t = 'hasPQcap(gen)'
54 t_is(hasPQcap(gen), [0,1,1,1,1,1,1,0,1,0,0], 12, t)
55
56 t = 'hasPQcap(gen, \'B\')'
57 t_is(hasPQcap(gen, 'B'), [0,1,1,1,1,1,1,0,1,0,0], 12, t)
58
59 t = 'hasPQcap(gen, \'U\')'
60 t_is(hasPQcap(gen, 'U'), [0,1,1,1,0,1,0,0,1,0,0], 12, t)
61
62 t = 'hasPQcap(gen, \'L\')'
63 t_is(hasPQcap(gen, 'L'), [0,1,0,1,1,1,1,0,0,0,0], 12, t)
64
65 t_end()
66
67
68 if __name__ == '__main__':
69 t_hasPQcap(quiet=False)
70