File: test_unicode.py

package info (click to toggle)
pymssql 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 972 kB
  • sloc: python: 3,801; sh: 152; makefile: 151; ansic: 1
file content (32 lines) | stat: -rw-r--r-- 756 bytes parent folder | download
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
# -*- coding: utf-8 -*-
"""
Test unicode usage in queries.
"""

import unittest

import pytest

from .helpers import pymssqlconn

@pytest.mark.mssql_server_required
class TestUnicode(unittest.TestCase):

    def setUp(self):
        self.conn = pymssqlconn()

    def test_unicode(self):
        # This test is for http://code.google.com/p/pymssql/issues/detail?id=60
        # Thanks to tonal.promsoft for reporting the issue and submitting a
        # patch.

        cursor = self.conn.cursor()
        cursor.execute(
            'select %s, %s',
            ('Здравствуй',
             'Мир'))  # Russian strings

        a, b = cursor.fetchone()

        self.assertEqual(a, 'Здравствуй')
        self.assertEqual(b, 'Мир')