Skip to content

Instantly share code, notes, and snippets.

@NickVolynkin
Last active July 21, 2016 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickVolynkin/05cddd48547556f0a4483dad45dc1809 to your computer and use it in GitHub Desktop.
Save NickVolynkin/05cddd48547556f0a4483dad45dc1809 to your computer and use it in GitHub Desktop.
# 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