From 86bb63bdc3aefe372b4ed1d6f15abe8c4d5b26f5 Mon Sep 17 00:00:00 2001 From: Russell Hay Date: Mon, 19 Sep 2016 10:14:05 -0700 Subject: [PATCH] Add a test to verify #80 (#83) --- test/assets/unicode.tds | 93 +++++++++++++++++++++++++++++++++++++++++ test/test_field.py | 10 +++++ 2 files changed, 103 insertions(+) create mode 100644 test/assets/unicode.tds diff --git a/test/assets/unicode.tds b/test/assets/unicode.tds new file mode 100644 index 000000000..6c6e7642d --- /dev/null +++ b/test/assets/unicode.tds @@ -0,0 +1,93 @@ + + + + + + + a + 130 + [a] + [xy] + a + 1 + string + Count + 255 + true + + "SQL_WVARCHAR" + "SQL_C_WCHAR" + "true" + + + + Today's Date + 130 + [Today's Date] + [xy] + a + 1 + string + Count + 255 + true + + "SQL_WVARCHAR" + "SQL_C_WCHAR" + "true" + + + + x + 3 + [x] + [xy] + x + 2 + integer + Sum + 10 + true + + "SQL_INTEGER" + "SQL_C_SLONG" + + + + y + 3 + [y] + [xy] + y + 3 + integer + Sum + 10 + true + + "SQL_INTEGER" + "SQL_C_SLONG" + + + + + + + + + + + + año + Something will go here too, in a muted gray + + + + + + + + + + + diff --git a/test/test_field.py b/test/test_field.py index 7cbe88599..b222e81be 100644 --- a/test/test_field.py +++ b/test/test_field.py @@ -12,6 +12,10 @@ TEST_ASSET_DIR, 'datasource_test.tds' ) +TEST_UNICODE_FILE = os.path.join( + TEST_ASSET_DIR, + 'unicode.tds' +) class FieldsUnitTest(unittest.TestCase): @@ -27,3 +31,9 @@ def find(self, *args, **kwargs): def test_find_metadata_record_returns_none(self): self.assertIsNone(_find_metadata_record(self.MockXmlWithNoFind(), 'foo')) + + +class FieldsHandleUnicode(unittest.TestCase): + def test_description_unicode(self): + ds = Datasource.from_file(TEST_UNICODE_FILE) + self.assertIsNotNone(ds.fields['A'].description)