Commit 56ec26a7 authored by Marius Wachtler's avatar Marius Wachtler

Merge pull request #1107 from undingen/unidecode_test

create a unidecode integration test and enable test_imp
parents 39b72d9c 101ea577
# expected: fail
import imp import imp
import unittest import unittest
from test import test_support from test import test_support
......
...@@ -2015,9 +2015,10 @@ void setupBuiltins() { ...@@ -2015,9 +2015,10 @@ void setupBuiltins() {
enumerate_cls = BoxedClass::create(type_cls, object_cls, &BoxedEnumerate::gcHandler, 0, 0, sizeof(BoxedEnumerate), enumerate_cls = BoxedClass::create(type_cls, object_cls, &BoxedEnumerate::gcHandler, 0, 0, sizeof(BoxedEnumerate),
false, "enumerate"); false, "enumerate");
enumerate_cls->giveAttr( enumerate_cls->giveAttr("__new__",
"__new__", new BoxedFunction(FunctionMetadata::create((void*)BoxedEnumerate::new_, UNKNOWN, 3, false, false), new BoxedFunction(FunctionMetadata::create((void*)BoxedEnumerate::new_, UNKNOWN, 3,
{ boxInt(0) })); ParamNames({ "", "sequence", "start" }, "", "")),
{ boxInt(0) }));
enumerate_cls->giveAttr("__iter__", new BoxedFunction(FunctionMetadata::create((void*)BoxedEnumerate::iter, enumerate_cls->giveAttr("__iter__", new BoxedFunction(FunctionMetadata::create((void*)BoxedEnumerate::iter,
typeFromClass(enumerate_cls), 1))); typeFromClass(enumerate_cls), 1)));
enumerate_cls->giveAttr("next", enumerate_cls->giveAttr("next",
......
...@@ -1383,7 +1383,7 @@ Box* longRTrueDiv(BoxedLong* v1, Box* _v2) { ...@@ -1383,7 +1383,7 @@ Box* longRTrueDiv(BoxedLong* v1, Box* _v2) {
} else { } else {
return NotImplemented; return NotImplemented;
} }
if (mpz_sgn(v2->n) == 0) { if (mpz_sgn(v1->n) == 0) {
raiseExcHelper(ZeroDivisionError, "division by zero"); raiseExcHelper(ZeroDivisionError, "division by zero");
} }
......
...@@ -111,7 +111,6 @@ test_imaplib [unknown] ...@@ -111,7 +111,6 @@ test_imaplib [unknown]
test_imgfile [unknown] test_imgfile [unknown]
test_importhooks [unknown] test_importhooks [unknown]
test_import [unknown] test_import [unknown]
test_imp [unknown]
test_inspect [unknown] test_inspect [unknown]
test_io memory/gc issue? test_io memory/gc issue?
test_iterlen [unknown] test_iterlen [unknown]
......
import os, sys, subprocess, shutil
sys.path.append(os.path.dirname(__file__) + "/../lib")
from test_helper import create_virtenv, run_test
ENV_NAME = "unidecode_test_env_" + os.path.basename(sys.executable)
SRC_DIR = os.path.abspath(os.path.join(ENV_NAME, "src"))
PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python"))
def install_and_test_unidecode():
shutil.rmtree(SRC_DIR, ignore_errors=True)
os.makedirs(SRC_DIR)
url = "https://pypi.python.org/packages/source/U/Unidecode/Unidecode-0.04.16.tar.gz"
subprocess.check_call(["wget", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "Unidecode-0.04.16.tar.gz"], cwd=SRC_DIR)
UNIDECODE_DIR = os.path.abspath(os.path.join(SRC_DIR, "Unidecode-0.04.16"))
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=UNIDECODE_DIR)
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=UNIDECODE_DIR)
expected = [{'ran': 8}]
run_test([PYTHON_EXE, "setup.py", "test"], cwd=UNIDECODE_DIR, expected=expected)
create_virtenv(ENV_NAME, None, force_create = True)
install_and_test_unidecode()
...@@ -36,6 +36,7 @@ print zip([1, 2, 3, 0], ["one", "two", "three"], ["uno", "dos", "tres", "quatro" ...@@ -36,6 +36,7 @@ print zip([1, 2, 3, 0], ["one", "two", "three"], ["uno", "dos", "tres", "quatro"
print filter(lambda x: x % 2, xrange(20)) print filter(lambda x: x % 2, xrange(20))
print type(enumerate([])) print type(enumerate([]))
print list(enumerate(xrange(5, 10))) print list(enumerate(xrange(5, 10)))
print list(enumerate(start=-42, sequence=xrange(5, 10)))
# If the first argument is None, filter calls checks for truthiness (ie is equivalent to passing 'bool') # If the first argument is None, filter calls checks for truthiness (ie is equivalent to passing 'bool')
print filter(None, xrange(-5, 5)) print filter(None, xrange(-5, 5))
......
...@@ -70,6 +70,7 @@ print pow(-5, 3, 7L) ...@@ -70,6 +70,7 @@ print pow(-5, 3, 7L)
print pow(-5, 3, -7L) print pow(-5, 3, -7L)
print (11L).__pow__(32, 50L) print (11L).__pow__(32, 50L)
print (11L).__index__() print (11L).__index__()
print (11L).__rtruediv__(0)
print long("100", 16) print long("100", 16)
print long("100", 10) print long("100", 10)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment