Skip to content

Commit

Permalink
Drop Python 3.5 support (#227)
Browse files Browse the repository at this point in the history
* Update .travis.yml

* Update README.md

* Update setup.py

* Update utils.py

* Update test_haskell.py
  • Loading branch information
StrikerRUS committed Jun 18, 2020
1 parent 4841241 commit dd61818
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 58 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ dist: xenial

language: python
python:
- 3.5
- 3.6
- 3.7
- 3.8
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* [FAQ](#faq)

## Installation
Supported Python version is >= **3.5**.
Supported Python version is >= **3.6**.
```
pip install m2cgen
```
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
],
keywords="sklearn ml code-generation",
python_requires=">=3.5",
python_requires=">=3.6",
install_requires=[
"numpy",
],
Expand Down
54 changes: 4 additions & 50 deletions tests/interpreters/test_haskell.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_dependable_condition():

expr = ast.IfExpr(bool_test, ast.NumVal(1), ast.FeatureRef(0))

expected_code_1 = """
expected_code = """
module Model where
score :: [Double] -> Double
score input =
Expand All @@ -80,31 +80,10 @@ def test_dependable_condition():
else
(input) !! (0)
"""
expected_code_2 = """
module Model where
score :: [Double] -> Double
score input =
func1
where
func1 =
if (((func0) + (2)) >= ((1) / (2)))
then
1
else
(input) !! (0)
func0 =
if ((1) == (1))
then
1
else
2
"""

interpreter = HaskellInterpreter()
actual_code = interpreter.interpret(expr)
# dicts in Python 3.5 have nondeterministic order of keys
utils.assert_code_equal_any_of(
actual_code, expected_code_1, expected_code_2)
utils.assert_code_equal(actual_code, expected_code)


def test_nested_condition():
Expand All @@ -124,7 +103,7 @@ def test_nested_condition():

expr = ast.IfExpr(bool_test, expr_nested, ast.NumVal(2))

expected_code_1 = """
expected_code = """
module Model where
score :: [Double] -> Double
score input =
Expand All @@ -147,35 +126,10 @@ def test_nested_condition():
else
2
"""
expected_code_2 = """
module Model where
score :: [Double] -> Double
score input =
func1
where
func1 =
if ((1) == ((func0) + (2)))
then
if ((1) == ((func0) + (2)))
then
(input) !! (2)
else
2
else
2
func0 =
if ((1) == (1))
then
1
else
2
"""

interpreter = HaskellInterpreter()
actual_code = interpreter.interpret(expr)
# dicts in Python 3.5 have nondeterministic order of keys
utils.assert_code_equal_any_of(
actual_code, expected_code_1, expected_code_2)
utils.assert_code_equal(actual_code, expected_code)


def test_raw_array():
Expand Down
4 changes: 0 additions & 4 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ def assert_code_equal(actual, expected):
assert actual.strip() == expected.strip()


def assert_code_equal_any_of(actual, *expected):
assert any(actual.strip() == expect.strip() for expect in expected)


get_regression_model_trainer = functools.partial(
ModelTrainer.get_instance, "boston")

Expand Down

0 comments on commit dd61818

Please sign in to comment.