File: test_sql_mssql.py

package info (click to toggle)
orange3 3.40.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,908 kB
  • sloc: python: 162,745; ansic: 622; makefile: 322; sh: 93; cpp: 77
file content (25 lines) | stat: -rw-r--r-- 740 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
import unittest

from Orange.data.sql.backend.base import BackendError
try:
    from Orange.data.sql.backend.mssql import PymssqlBackend, parse_ex
    err = ""
except ModuleNotFoundError as ex:
    PymssqlBackend = None
    err = str(ex)


class TestPymssqlBackend(unittest.TestCase):
    @unittest.skipIf(PymssqlBackend is None, err)
    def test_connection_error(self):
        connection_params = {"host": "host", "port": "", "database": "DB"}
        self.assertRaises(BackendError, PymssqlBackend, connection_params)

    @unittest.skipIf(PymssqlBackend is None, err)
    def test_parse_ex(self):
        err_msg = "Foo"
        self.assertEqual(parse_ex(ValueError(err_msg)), err_msg)


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