From 37003d2ed18851e046a401fee8fab67be8516c4d Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 29 Aug 2013 14:08:53 -0400 Subject: [PATCH] Bump version to 0.4.dev and add support for Python 3.2. --- .travis.yml | 1 + CHANGELOG | 4 ++++ docs/changelog.rst | 8 ++++++++ mwparserfromhell/__init__.py | 2 +- mwparserfromhell/compat.py | 3 ++- mwparserfromhell/string_mixin.py | 8 ++++---- setup.py | 1 + tests/test_string_mixin.py | 10 ++++++---- tests/tokenizer/tags.mwtest | 2 +- 9 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7a9920d..347badd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python python: - "2.7" + - "3.2" - "3.3" install: python setup.py build script: python setup.py test -q diff --git a/CHANGELOG b/CHANGELOG index 4663700..9fa2ff6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v0.4 (unreleased): + +- Added support for Python 3.2 (along with current support for 3.3 and 2.7). + v0.3.1 (released August 29, 2013): - Fixed a parser bug involving URLs nested inside other markup. diff --git a/docs/changelog.rst b/docs/changelog.rst index 3546f0c..04baf03 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,14 @@ Changelog ========= +v0.4 +---- + +Unreleased +(`changes `__): + +- Added support for Python 3.2 (along with current support for 3.3 and 2.7). + v0.3.1 ------ diff --git a/mwparserfromhell/__init__.py b/mwparserfromhell/__init__.py index a5fda7c..3c011d0 100644 --- a/mwparserfromhell/__init__.py +++ b/mwparserfromhell/__init__.py @@ -31,7 +31,7 @@ from __future__ import unicode_literals __author__ = "Ben Kurtovic" __copyright__ = "Copyright (C) 2012, 2013 Ben Kurtovic" __license__ = "MIT License" -__version__ = "0.3.1" +__version__ = "0.4.dev" __email__ = "ben.kurtovic@verizon.net" from . import (compat, definitions, nodes, parser, smart_list, string_mixin, diff --git a/mwparserfromhell/compat.py b/mwparserfromhell/compat.py index 864605c..a142128 100644 --- a/mwparserfromhell/compat.py +++ b/mwparserfromhell/compat.py @@ -10,7 +10,8 @@ types are meant to be imported directly from within the parser's modules. import sys -py3k = sys.version_info[0] == 3 +py3k = sys.version_info.major == 3 +py32 = py3k and sys.version_info.minor == 2 if py3k: bytes = bytes diff --git a/mwparserfromhell/string_mixin.py b/mwparserfromhell/string_mixin.py index a406401..c52d4ca 100644 --- a/mwparserfromhell/string_mixin.py +++ b/mwparserfromhell/string_mixin.py @@ -27,7 +27,7 @@ interface for the ``unicode`` type (``str`` on py3k) in a dynamic manner. from __future__ import unicode_literals -from .compat import py3k, str +from .compat import py3k, py32, str __all__ = ["StringMixIn"] @@ -125,7 +125,7 @@ class StringMixIn(object): def capitalize(self): return self.__unicode__().capitalize() - if py3k: + if py3k and not py32: @inheritdoc def casefold(self): return self.__unicode__().casefold() @@ -288,7 +288,7 @@ class StringMixIn(object): def rpartition(self, sep): return self.__unicode__().rpartition(sep) - if py3k: + if py3k and not py32: @inheritdoc def rsplit(self, sep=None, maxsplit=None): kwargs = {} @@ -310,7 +310,7 @@ class StringMixIn(object): def rstrip(self, chars=None): return self.__unicode__().rstrip(chars) - if py3k: + if py3k and not py32: @inheritdoc def split(self, sep=None, maxsplit=None): kwargs = {} diff --git a/setup.py b/setup.py index d2ad17d..d6e77a1 100644 --- a/setup.py +++ b/setup.py @@ -54,6 +54,7 @@ setup( "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Text Processing :: Markup" ], diff --git a/tests/test_string_mixin.py b/tests/test_string_mixin.py index b829bb2..5ee857c 100644 --- a/tests/test_string_mixin.py +++ b/tests/test_string_mixin.py @@ -25,7 +25,7 @@ from sys import getdefaultencoding from types import GeneratorType import unittest -from mwparserfromhell.compat import bytes, py3k, str +from mwparserfromhell.compat import bytes, py3k, py32, str from mwparserfromhell.string_mixin import StringMixIn from .compat import range @@ -52,8 +52,10 @@ class TestStringMixIn(unittest.TestCase): "rsplit", "rstrip", "split", "splitlines", "startswith", "strip", "swapcase", "title", "translate", "upper", "zfill"] if py3k: - methods.extend(["casefold", "format_map", "isidentifier", - "isprintable", "maketrans"]) + if not py32: + methods.append("casefold") + methods.extend(["format_map", "isidentifier", "isprintable", + "maketrans"]) else: methods.append("decode") for meth in methods: @@ -325,7 +327,7 @@ class TestStringMixIn(unittest.TestCase): self.assertEqual("", str15.lower()) self.assertEqual("foobar", str16.lower()) self.assertEqual("ß", str22.lower()) - if py3k: + if py3k and not py32: self.assertEqual("", str15.casefold()) self.assertEqual("foobar", str16.casefold()) self.assertEqual("ss", str22.casefold()) diff --git a/tests/tokenizer/tags.mwtest b/tests/tokenizer/tags.mwtest index a0d7f18..a8ca2f0 100644 --- a/tests/tokenizer/tags.mwtest +++ b/tests/tokenizer/tags.mwtest @@ -470,7 +470,7 @@ output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(t name: unparsable_attributed label: a tag that should not be put through the normal parser; parsed attributes input: "{{t1}}{{t2}}{{t3}}" -output: [TemplateOpen(), Text(text=u't1'), TemplateClose(), TagOpenOpen(), Text(text="nowiki"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr"), TagAttrEquals(), Text(text="val"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr2"), TagAttrEquals(), TagAttrQuote(), TemplateOpen(), Text(text="val2"), TemplateClose(), TagCloseOpen(padding=""), Text(text="{{t2}}"), TagOpenClose(), Text(text="nowiki"), TagCloseClose(), TemplateOpen(), Text(text="t3"), TemplateClose()] +output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(text="nowiki"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr"), TagAttrEquals(), Text(text="val"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr2"), TagAttrEquals(), TagAttrQuote(), TemplateOpen(), Text(text="val2"), TemplateClose(), TagCloseOpen(padding=""), Text(text="{{t2}}"), TagOpenClose(), Text(text="nowiki"), TagCloseClose(), TemplateOpen(), Text(text="t3"), TemplateClose()] ---