Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Commit

Permalink
refactor test to just read from fixture file when necessary to improv…
Browse files Browse the repository at this point in the history
…e test performance
  • Loading branch information
lipemorais committed Oct 27, 2017
1 parent beceb14 commit dc7b91a
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,27 @@
class TestElectionExpensesClassifier(TestCase):

def setUp(self):
self.dataframe = pd.read_csv('rosie/chamber_of_deputies/tests/fixtures/election_expenses_classifier.csv',
dtype={'name': np.str, 'legal_entity': np.str})
self.election_expenser_classifier = ElectionExpensesClassifier()

def test_is_election_company(self):
def test_legal_entity_is_a_election_company(self):
self.dataframe = pd.read_csv('rosie/chamber_of_deputies/tests/fixtures/election_expenses_classifier.csv',
dtype={'name': np.str, 'legal_entity': np.str})

prediction_result = self.election_expenser_classifier.predict(self.dataframe)

self.assertEqual(prediction_result[0], True)

def test_is_not_election_company(self):
def test_legal_entity_is_not_election_company(self):
self.dataframe = pd.read_csv('rosie/chamber_of_deputies/tests/fixtures/election_expenses_classifier.csv',
dtype={'name': np.str, 'legal_entity': np.str})

prediction_result = self.election_expenser_classifier.predict(self.dataframe)

self.assertEqual(prediction_result[1], False)

def test_fit_just_for_formality_because_its_never_used(self):
self.assertTrue(self.election_expenser_classifier.fit(self.dataframe) is None)
empty_dataframe = pd.DataFrame()
self.assertTrue(self.election_expenser_classifier.fit(empty_dataframe) is None)

def test_transform_just_for_formality_because_its_never_used(self):
self.assertTrue(self.election_expenser_classifier.transform() is None)

0 comments on commit dc7b91a

Please sign in to comment.