Skip to content

Commit b5275b1

Browse files
authored
Make tests PEP8 compliant (#829)
* Make tests PEP8 compliant * bug fix * Implement PR review comments * Implement PR review sugestions * fix small bug
1 parent cff2e21 commit b5275b1

File tree

68 files changed

+405
-424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+405
-424
lines changed

ci_scripts/flake8_full.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ flake8 --max-line-length=100 --show-source autosklearn/data
66
flake8 --max-line-length=100 --show-source autosklearn/metrics
77
flake8 --max-line-length=100 --show-source autosklearn/metalearning
88
flake8 --max-line-length=100 --show-source autosklearn/pipeline
9+
flake8 --max-line-length=100 --show-source test/

test/test_automl/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def setUp(self):
1515
self.test_dir = os.path.dirname(__file__)
1616

1717
try:
18-
travis = os.environ['TRAVIS']
18+
os.environ['TRAVIS']
1919
self.travis = True
2020
except Exception:
2121
self.travis = False
@@ -55,4 +55,4 @@ def _tearDown(self, dir):
5555
shutil.rmtree(dir)
5656
break
5757
except OSError:
58-
time.sleep(1)
58+
time.sleep(1)

test/test_automl/test_automl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from smac.scenario.scenario import Scenario
1313
from smac.facade.roar_facade import ROAR
1414

15-
from autosklearn.util.backend import Backend, BackendContext
15+
from autosklearn.util.backend import Backend
1616
from autosklearn.automl import AutoML
1717
import autosklearn.automl
1818
from autosklearn.metrics import accuracy
@@ -23,7 +23,7 @@
2323
from smac.tae.execute_ta_run import StatusType
2424

2525
sys.path.append(os.path.dirname(__file__))
26-
from base import Base
26+
from base import Base # noqa
2727

2828

2929
class AutoMLStub(AutoML):
@@ -391,5 +391,5 @@ def test_fail_if_dummy_prediction_fails(self, ta_run_mock):
391391
self._tearDown(backend_api.output_directory)
392392

393393

394-
if __name__=="__main__":
394+
if __name__ == "__main__":
395395
unittest.main()

test/test_data/test_competition_c_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ def test_read_dense(self):
3535
filename, 670, 20, 0.01)
3636
self.assertEqual(data.shape, (131, 20))
3737

38+
3839
if __name__ == "__main__":
3940
unittest.main()

test/test_data/test_competition_data_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import os
22
import unittest
33

4-
from autosklearn.data.competition_data_manager import CompetitionDataManager
5-
64

75
class CompetitionDataManagerTest(unittest.TestCase):
86
_multiprocess_can_split_ = True

test/test_data/test_data_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import unittest
32

43
import numpy as np
@@ -90,7 +89,7 @@ def test_perform1HotEncoding_categorical_data(self):
9089

9190
def test_perform1HotEncoding_binary_data_with_missing_values(self):
9291
# self.D.feat_type = [N, N, N, N, B, B]
93-
#self.D.info = {'is_sparse': 0, 'has_missing': 1}
94-
#self.D.perform1HotEncoding()
95-
#self.assertEqual((3, 8), self.D.data['X_train'].shape)
92+
# self.D.info = {'is_sparse': 0, 'has_missing': 1}
93+
# self.D.perform1HotEncoding()
94+
# self.assertEqual((3, 8), self.D.data['X_train'].shape)
9695
pass
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
# -*- encoding: utf-8 -*-
22
__author__ = 'mlindauer'
3-
4-

test/test_ensemble_builder/test_ensemble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def testRead(self):
5050
ensbuilder = EnsembleBuilder(
5151
backend=self.backend,
5252
dataset_name="TEST",
53-
task_type=1, #Binary Classification
53+
task_type=1, # Binary Classification
5454
metric=roc_auc,
5555
limit=-1, # not used,
5656
seed=0, # important to find the test files

test/test_evaluation/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
# -*- encoding: utf-8 -*-
22
__author__ = 'feurerm'
3-
4-

test/test_evaluation/evaluation_util.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import functools
22
import os
3-
import sys
43
import traceback
54
import unittest
65

76
import numpy as np
87
from numpy.linalg import LinAlgError
98
import sklearn.datasets
109

11-
from autosklearn.constants import *
10+
from autosklearn.constants import \
11+
MULTICLASS_CLASSIFICATION, MULTILABEL_CLASSIFICATION, BINARY_CLASSIFICATION, REGRESSION
1212
from autosklearn.util.data import convert_to_bin
1313
from autosklearn.data.competition_data_manager import CompetitionDataManager
1414
from autosklearn.pipeline.util import get_dataset
@@ -123,13 +123,13 @@ def get_multilabel_classification_datamanager():
123123
Y_train = Y_train[indices]
124124

125125
Y_train = np.array(convert_to_bin(Y_train, 3))
126-
#for i in range(Y_train_.shape[0]):
126+
# for i in range(Y_train_.shape[0]):
127127
# Y_train_[:, Y_train[i]] = 1
128-
#Y_train = Y_train_
128+
# Y_train = Y_train_
129129
Y_test = np.array(convert_to_bin(Y_test, 3))
130-
#for i in range(Y_test_.shape[0]):
130+
# for i in range(Y_test_.shape[0]):
131131
# Y_test_[:, Y_test[i]] = 1
132-
#Y_test = Y_test_
132+
# Y_test = Y_test_
133133

134134
X_valid = X_test[:25, ]
135135
Y_valid = Y_test[:25, ]

0 commit comments

Comments
 (0)