File: test_unicode.py

package info (click to toggle)
pymssql 2.1.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 952 kB
  • sloc: python: 2,872; sh: 240; makefile: 148; ansic: 7
file content (24 lines) | stat: -rw-r--r-- 753 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
import unittest

from .helpers import pymssqlconn

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(
            u'select %s, %s',
            (u'\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439',
             u'\u041c\u0438\u0440'))  # Russian strings

        a, b = cursor.fetchone()

        self.assertEquals(a, u'\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439')
        self.assertEquals(b, u'\u041c\u0438\u0440')