Просмотр исходного кода

Drop support for EOL Python

tags/v0.5.2
Hugo 6 лет назад
Родитель
Сommit
59636609db
29 измененных файлов: 35 добавлений и 155 удалений
  1. +0
    -1
      .coveragerc
  2. +0
    -4
      .travis.yml
  3. +0
    -2
      mwparserfromhell/compat.py
  4. +1
    -10
      mwparserfromhell/string_mixin.py
  5. +5
    -8
      setup.py
  6. +1
    -5
      tests/_test_tree_equality.py
  7. +1
    -8
      tests/discover.py
  8. +1
    -5
      tests/test_argument.py
  9. +1
    -5
      tests/test_attribute.py
  10. +1
    -5
      tests/test_builder.py
  11. +1
    -5
      tests/test_comment.py
  12. +1
    -5
      tests/test_ctokenizer.py
  13. +1
    -5
      tests/test_docs.py
  14. +1
    -5
      tests/test_external_link.py
  15. +1
    -5
      tests/test_heading.py
  16. +1
    -5
      tests/test_html_entity.py
  17. +1
    -5
      tests/test_parameter.py
  18. +1
    -5
      tests/test_parser.py
  19. +1
    -5
      tests/test_pytokenizer.py
  20. +1
    -5
      tests/test_roundtripping.py
  21. +1
    -5
      tests/test_smart_list.py
  22. +6
    -12
      tests/test_string_mixin.py
  23. +1
    -5
      tests/test_tag.py
  24. +1
    -5
      tests/test_template.py
  25. +1
    -5
      tests/test_text.py
  26. +1
    -5
      tests/test_tokens.py
  27. +1
    -5
      tests/test_utils.py
  28. +1
    -5
      tests/test_wikicode.py
  29. +1
    -5
      tests/test_wikilink.py

+ 0
- 1
.coveragerc Просмотреть файл

@@ -6,4 +6,3 @@ partial_branches =
pragma: no branch
if py3k:
if not py3k:
if py26:

+ 0
- 4
.travis.yml Просмотреть файл

@@ -1,16 +1,12 @@
language: python
python:
- 2.6
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- 3.6
- nightly
sudo: false
install:
- if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install coverage==3.7.1; fi
- pip install coveralls
- python setup.py build
script:


+ 0
- 2
mwparserfromhell/compat.py Просмотреть файл

@@ -10,9 +10,7 @@ meant to be imported directly from within the parser's modules.

import sys

py26 = (sys.version_info[0] == 2) and (sys.version_info[1] == 6)
py3k = (sys.version_info[0] == 3)
py32 = py3k and (sys.version_info[1] == 2)

if py3k:
bytes = bytes


+ 1
- 10
mwparserfromhell/string_mixin.py Просмотреть файл

@@ -28,7 +28,7 @@ interface for the ``unicode`` type (``str`` on py3k) in a dynamic manner.
from __future__ import unicode_literals
from sys import getdefaultencoding

from .compat import bytes, py26, py3k, str
from .compat import bytes, py3k, str

__all__ = ["StringMixIn"]

@@ -116,14 +116,5 @@ class StringMixIn(object):
if py3k:
maketrans = str.maketrans # Static method can't rely on __getattr__

if py26:
@inheritdoc
def encode(self, encoding=None, errors=None):
if encoding is None:
encoding = getdefaultencoding()
if errors is not None:
return self.__unicode__().encode(encoding, errors)
return self.__unicode__().encode(encoding)


del inheritdoc

+ 5
- 8
setup.py Просмотреть файл

@@ -27,15 +27,15 @@ from glob import glob
from os import environ
import sys

if ((sys.version_info[0] == 2 and sys.version_info[1] < 6) or
(sys.version_info[1] == 3 and sys.version_info[1] < 2)):
raise RuntimeError("mwparserfromhell needs Python 2.6+ or 3.2+")
if ((sys.version_info[0] == 2 and sys.version_info[1] < 7) or
(sys.version_info[1] == 3 and sys.version_info[1] < 4)):
raise RuntimeError("mwparserfromhell needs Python 2.7 or 3.4+")

from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext

from mwparserfromhell import __version__
from mwparserfromhell.compat import py26, py3k
from mwparserfromhell.compat import py3k

with open("README.rst", **({'encoding':'utf-8'} if py3k else {})) as fp:
long_docs = fp.read()
@@ -82,7 +82,6 @@ setup(
name = "mwparserfromhell",
packages = find_packages(exclude=("tests",)),
ext_modules = [tokenizer] if use_extension else [],
tests_require = ["unittest2"] if py26 else [],
test_suite = "tests.discover",
version = __version__,
author = "Ben Kurtovic",
@@ -99,11 +98,9 @@ setup(
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",


+ 1
- 5
tests/_test_tree_equality.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
from unittest2 import TestCase
except ImportError:
from unittest import TestCase
from unittest import TestCase

from mwparserfromhell.compat import range
from mwparserfromhell.nodes import (Argument, Comment, Heading, HTMLEntity,


+ 1
- 8
tests/discover.py Просмотреть файл

@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-

"""
Discover tests using ``unittest2` for Python 2.6.

It appears the default distutils test suite doesn't play nice with
``setUpClass`` thereby making some tests fail. Using ``unittest2`` to load
tests seems to work around that issue.
@@ -12,12 +10,7 @@ http://stackoverflow.com/a/17004409/753501

import os.path

from mwparserfromhell.compat import py26

if py26:
import unittest2 as unittest
else:
import unittest
import unittest

def additional_tests():
project_root = os.path.split(os.path.dirname(__file__))[0]


+ 1
- 5
tests/test_argument.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Argument, Text


+ 1
- 5
tests/test_attribute.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Template


+ 1
- 5
tests/test_builder.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import py3k
from mwparserfromhell.nodes import (Argument, Comment, ExternalLink, Heading,


+ 1
- 5
tests/test_comment.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Comment


+ 1
- 5
tests/test_ctokenizer.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

try:
from mwparserfromhell.parser._tokenizer import CTokenizer


+ 1
- 5
tests/test_docs.py Просмотреть файл

@@ -23,11 +23,7 @@
from __future__ import print_function, unicode_literals
import json
import os

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

import mwparserfromhell
from mwparserfromhell.compat import py3k, str


+ 1
- 5
tests/test_external_link.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import ExternalLink, Text


+ 1
- 5
tests/test_heading.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Heading, Text


+ 1
- 5
tests/test_html_entity.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import HTMLEntity


+ 1
- 5
tests/test_parameter.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Text


+ 1
- 5
tests/test_parser.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell import parser
from mwparserfromhell.compat import range


+ 1
- 5
tests/test_pytokenizer.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.parser.tokenizer import Tokenizer



+ 1
- 5
tests/test_roundtripping.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from ._test_tokenizer import TokenizerTestCase



+ 1
- 5
tests/test_smart_list.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import py3k, range
from mwparserfromhell.smart_list import SmartList, _ListProxy


+ 6
- 12
tests/test_string_mixin.py Просмотреть файл

@@ -23,13 +23,9 @@
from __future__ import unicode_literals
from sys import getdefaultencoding
from types import GeneratorType
import unittest

try:
import unittest2 as unittest
except ImportError:
import unittest

from mwparserfromhell.compat import bytes, py3k, py32, range, str
from mwparserfromhell.compat import bytes, py3k, range, str
from mwparserfromhell.string_mixin import StringMixIn

class _FakeString(StringMixIn):
@@ -54,9 +50,7 @@ class TestStringMixIn(unittest.TestCase):
"rsplit", "rstrip", "split", "splitlines", "startswith", "strip",
"swapcase", "title", "translate", "upper", "zfill"]
if py3k:
if not py32:
methods.append("casefold")
methods.extend(["format_map", "isidentifier", "isprintable",
methods.extend(["casefold", "format_map", "isidentifier", "isprintable",
"maketrans"])
else:
methods.append("decode")
@@ -329,7 +323,7 @@ class TestStringMixIn(unittest.TestCase):
self.assertEqual("", str15.lower())
self.assertEqual("foobar", str16.lower())
self.assertEqual("ß", str22.lower())
if py3k and not py32:
if py3k:
self.assertEqual("", str15.casefold())
self.assertEqual("foobar", str16.casefold())
self.assertEqual("ss", str22.casefold())
@@ -378,7 +372,7 @@ class TestStringMixIn(unittest.TestCase):
self.assertEqual(actual, str25.rsplit(None, 3))
actual = [" this is a sentence with", "", "whitespace", ""]
self.assertEqual(actual, str25.rsplit(" ", 3))
if py3k and not py32:
if py3k:
actual = [" this is a", "sentence", "with", "whitespace"]
self.assertEqual(actual, str25.rsplit(maxsplit=3))

@@ -396,7 +390,7 @@ class TestStringMixIn(unittest.TestCase):
self.assertEqual(actual, str25.split(None, 3))
actual = ["", "", "", "this is a sentence with whitespace "]
self.assertEqual(actual, str25.split(" ", 3))
if py3k and not py32:
if py3k:
actual = ["this", "is", "a", "sentence with whitespace "]
self.assertEqual(actual, str25.split(maxsplit=3))



+ 1
- 5
tests/test_tag.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Tag, Template, Text


+ 1
- 5
tests/test_template.py Просмотреть файл

@@ -22,11 +22,7 @@

from __future__ import unicode_literals
from difflib import unified_diff

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import HTMLEntity, Template, Text


+ 1
- 5
tests/test_text.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Text


+ 1
- 5
tests/test_tokens.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import py3k
from mwparserfromhell.parser import tokens


+ 1
- 5
tests/test_utils.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.nodes import Template, Text
from mwparserfromhell.utils import parse_anything


+ 1
- 5
tests/test_wikicode.py Просмотреть файл

@@ -24,11 +24,7 @@ from __future__ import unicode_literals
from functools import partial
import re
from types import GeneratorType

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import py3k, str
from mwparserfromhell.nodes import (Argument, Comment, Heading, HTMLEntity,


+ 1
- 5
tests/test_wikilink.py Просмотреть файл

@@ -21,11 +21,7 @@
# SOFTWARE.

from __future__ import unicode_literals

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from mwparserfromhell.compat import str
from mwparserfromhell.nodes import Text, Wikilink


Загрузка…
Отмена
Сохранить