File: test_gsl.py

package info (click to toggle)
cvxopt 1.3.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,720 kB
  • sloc: ansic: 23,233; python: 10,414; makefile: 72; sh: 7
file content (29 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (3)
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
import unittest

class TestGSL(unittest.TestCase):

    def setUp(self):
        try:
            from cvxopt import gsl
        except:
            self.skipTest("GSL not available")

    def test1(self):
        from cvxopt import gsl
        gsl.setseed(123)
        self.assertTrue(gsl.getseed()==123)
        gsl.setseed()
        self.assertTrue(gsl.getseed()>0)

    def test2(self):
        from cvxopt import gsl
        x = gsl.normal(3,2)
        self.assertTrue(x.size[0] == 3 and x.size[1] == 2)

    def test3(self):
        from cvxopt import gsl
        x = gsl.uniform(4,3)
        self.assertTrue(x.size[0] == 4 and x.size[1] == 3)

if __name__ == '__main__':
    unittest.main()