'Test try int'

def test_try_int_with_default(self):

    default_value = 42
    test_cases = {None: default_value, u'': default_value, u'123': 123, u'-123': (-123), u'12.3': default_value, u'-12.3': default_value, 0: 0, 123: 123, (-123): (-123), 12.3: 12, (-12.3): (-12)}
    unicode_test_cases = {u'': default_value, u'123': 123, u'-123': (-123), u'12.3': default_value, u'-12.3': default_value}
    for test in (test_cases, unicode_test_cases):
        for (candidate, result) in six.iteritems(test):
            self.assertEqual(try_int(candidate, default_value), result)
