Commit e6472154 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

Add tests

Note: fixers -> fixes, because of how test's `fixer_pkg` works.
parent b3bb4cea
......@@ -2,4 +2,4 @@ from lib2to3.main import main
import sys
sys.exit(main('my2to3.fixers'))
sys.exit(main('my2to3.fixes'))
from functools import partial
from lib2to3.tests.test_fixers import FixerTestCase as lib2to3FixerTestCase
import unittest
class FixerTestCase(lib2to3FixerTestCase):
# Subclass to replace "fixer_pkg"
def setUp(self, fix_list=None, fixer_pkg="my2to3", options=None):
super(FixerTestCase, self).setUp(fix_list, fixer_pkg, options)
class testFixTraceDivision(FixerTestCase):
fixer = "trace_division"
def test_simple_division(self):
b = """x / y"""
a = """division_traced(0,x , y)"""
self.check(b, a)
def test_nested_divisions_with_parentheses_1(self):
b = """(x / y) / z"""
a = """division_traced(1,(division_traced(0,x , y)) , z)"""
self.check(b, a)
def test_nested_divisions_with_parentheses_2(self):
b = """x / (y / z)"""
a = """division_traced(1,x , (division_traced(0,y , z)))"""
self.check(b, a)
def test_multiline_division_1(self):
b = """x \
/ y"""
a = """ division_traced(0,x \
, y)"""
self.check(b, a)
if __name__ == '__main__':
unittest.main()
from setuptools import setup
setup(
name="my2to3",
test_suite='my2to3.tests',
)
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