1 | """
|
---|
2 | Test the django sqlite3 driver to make sure it properly loads/stores unicode
|
---|
3 |
|
---|
4 | >>> u_data = u'\xc5land islands'
|
---|
5 | >>> db = DatabaseWrapper()
|
---|
6 | >>> cur = db.cursor()
|
---|
7 |
|
---|
8 | We have to make sure we're using the 'real' sqlite cursor, not some
|
---|
9 | debugcursor
|
---|
10 | >>> assert isinstance(cur, SQLiteCursorWrapper)
|
---|
11 |
|
---|
12 | >>> cur.execute("create table foo (blah varchar)")
|
---|
13 | >>> cur.execute("insert into foo (blah) values (%s)", [u_data])
|
---|
14 | >>> cur.execute("select * from foo")
|
---|
15 | >>> assert cur.fetchone()[0] == u_data
|
---|
16 |
|
---|
17 | """
|
---|
18 |
|
---|
19 |
|
---|
20 | from django.db.backends.sqlite3.base import DatabaseWrapper, SQLiteCursorWrapper
|
---|
21 | import datetime
|
---|
22 |
|
---|
23 | if __name__ == '__main__':
|
---|
24 | import doctest
|
---|
25 | doctest.testmod()
|
---|