diff options
author | Kane Blueriver <kxxoling@gmail.com> | 2015-06-23 10:05:27 +0800 |
---|---|---|
committer | Kane Blueriver <kxxoling@gmail.com> | 2015-06-23 10:05:27 +0800 |
commit | 4d23592c9c6814b13883cf3c62f21acdea40a606 (patch) | |
tree | 40f73797db2575e960eff7823c96cc71287e931b | |
parent | 69487da814c6e8b39018048b227a863d12f93963 (diff) | |
parent | d1b50cfb7db88183953f7397c62aca1a6fe72348 (diff) | |
download | python-prettytable-ptable-4d23592c9c6814b13883cf3c62f21acdea40a606.tar.gz |
Merge branch 'develop' into feature/tox-with-coverage
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | tests/__init__.py | 0 | ||||
-rw-r--r-- | tests/test_utils.py | 29 | ||||
-rw-r--r-- | tox.ini | 1 |
4 files changed, 31 insertions, 4 deletions
@@ -6,8 +6,7 @@ PACKAGE_NAME = prettytable all: coverage test: - @nosetests - @nosetests --with-coverage --cover-min-percentage=$(COVER_PERC) + @nosetests --with-coverage --cover-package=$(PACKAGE_NAME) --cover-min-percentage=$(COVER_PERC) clean: clean-pyc clean-build clean-cover @@ -27,7 +26,7 @@ clean-cover: coverage: #clean-cover @nosetests --with-coverage --cover-package=$(PACKAGE_NAME) --cover-html --cover-html-dir=$(COVERAGE_DIR) -opencover: test +opencover: coverage @open $(COVERAGE_DIR)/index.html make-docs: diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/__init__.py diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..6ed710b --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,29 @@ +# -*- coding:utf-8 -*- +from __future__ import unicode_literals +import unittest + +from prettytable.prettytable import _char_block_width + + + +def _width_test_factory(width, words): + def _(self): + map(lambda x: self.assertEqual(width, _char_block_width(ord(x))), + list(words)) + return _ + + +class CharBlockWidthTest(unittest.TestCase): + fixtures = { + 'normal': (1, '12345qwerljk/.,WESD'), + 'chs': (2, '石室诗士施氏嗜狮誓食十狮'), + 'jp': (2, 'はじめまして'), + 'hangul': (2, '우리글자언문청'), + 'full_width_latin': (2, 'XYZ[\]^_xyz{|}~⦅'), + # 'cjk': (2, u''), + } + + def test_fixtures(self): + for name in self.fixtures: + _width_test_factory(*self.fixtures[name])(self) + @@ -5,4 +5,3 @@ envlist = py27,py3 deps = nose coverage commands = make test - |