Skip to content

Commit

Permalink
Adding shim compatability for python2.7 and python3.6 by allowing for…
Browse files Browse the repository at this point in the history
… assertCountEqual in both
  • Loading branch information
bjherger committed Jun 15, 2018
1 parent 7aaa64b commit 2812b2b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/testautomater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

from keras_pandas import lib
from keras_pandas.Automater import Automater
from tests.testbase import TestBase

logging.getLogger().setLevel(logging.INFO)


class TestAutomater(unittest.TestCase):
class TestAutomater(TestBase):

def test_check_variable_lists_are_valid(self):
# Base case: No variables
Expand Down Expand Up @@ -104,7 +105,6 @@ def test_initializer(self):

response_variable_list = [item for sublist in response.values() for item in sublist]
self.assertCountEqual(response_variable_list, auto._user_provided_variables)

# Overlapping variable lists
data = {
'numerical_vars': ['n1', 'n2', 'n3', 'x1'],
Expand Down
11 changes: 11 additions & 0 deletions tests/testbase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import unittest


class TestBase(unittest.TestCase):

def __init__(self, *args, **kwargs):
super(TestBase, self).__init__(*args, **kwargs)

if not hasattr(self, 'assertCountEqual'):
self.assertCountEqual = self.assertItemsEqual

3 changes: 2 additions & 1 deletion tests/testcategorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

from keras_pandas import lib
from keras_pandas.Automater import Automater
from tests.testbase import TestBase


class TestCategorical(unittest.TestCase):
class TestCategorical(TestBase):

def test_fit(self):
train_df = lib.load_mushroom()
Expand Down
3 changes: 2 additions & 1 deletion tests/testembeddingvectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

from keras_pandas import lib
from keras_pandas.transformations import EmbeddingVectorizer
from tests.testbase import TestBase

logging.getLogger().setLevel(logging.INFO)


class TestEmbeddingVectorizer(unittest.TestCase):
class TestEmbeddingVectorizer(TestBase):

def test_padding(self):
# Empty string
Expand Down
3 changes: 2 additions & 1 deletion tests/testnumeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

from keras_pandas import lib
from keras_pandas.Automater import Automater
from tests.testbase import TestBase

logging.getLogger().setLevel(logging.INFO)


class TestNumeric(unittest.TestCase):
class TestNumeric(TestBase):

def test_fit(self):
iris_df = lib.load_iris()
Expand Down
3 changes: 2 additions & 1 deletion tests/testtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

from keras_pandas import lib
from keras_pandas.Automater import Automater
from tests.testbase import TestBase

logging.getLogger().setLevel(logging.INFO)


class TestText(unittest.TestCase):
class TestText(TestBase):

def test_fit(self):
data = lib.load_titanic()
Expand Down

0 comments on commit 2812b2b

Please sign in to comment.