-
-
Save NickVolynkin/05cddd48547556f0a4483dad45dc1809 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
from unittest import TestCase | |
from classes.evaluators import * | |
test_filtered = { | |
'barrier': 'barrier', | |
'id': 94, | |
'names': [], | |
'pass_type': 'main', | |
'payment': 'paid', | |
'text': '', | |
'toll': 'undef', | |
'type': 'pass_through' | |
} | |
test_sample_dict = { | |
'barrier': 'shmarrier', | |
'pass_type': 'whatever', | |
'payment': 'blabla', | |
'text': '', | |
'toll': 'undef', | |
'type': 'pass_through' | |
} | |
test_sample_list = ['barrier', 'pass_type', 'payment', 'text', 'toll', 'type'] | |
test_result = { | |
'barrier': 'barrier', | |
'text': '', | |
'toll': 'undef', | |
'type': 'pass_through', | |
'payment': 'paid', | |
'pass_type': 'main' | |
} | |
class TestEvaluators(TestCase): | |
def test_with_dict(self): | |
""" | |
checking filter_dict with dictionary | |
""" | |
curry = filter_dict(test_sample_dict) | |
self.assertDictEqual(curry(test_filtered), test_result) | |
def test_with_list(self): | |
""" | |
checking filter_dict with list | |
""" | |
curry = filter_dict(test_sample_list) | |
self.assertDictEqual(curry(test_filtered), test_result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment