예제 #1
0
def check_ruler(ruler, t):
    """Build fields status dict obtained by applying ruler to transaction."""
    extras = {}
    match, match_info = tags.match(ruler, t)
    for (key, val) in match_info.items():
        if not val:
            extras[key] = TERM.red("%s %s" % (TERM.KO, key.title()))
        else:
            extras[key] = TERM.green("%s %s" % (TERM.OK, key.title()))
    if not match:
        extras["category"] = TERM.red("%s Category" % TERM.KO)
    else:
        extras["category"] = TERM.green("%s Category" % TERM.OK)
    return match, extras
예제 #2
0
def check_ruler(ruler, t):
    """Build fields status dict obtained by applying ruler to transaction.
    """
    extras = {}
    match, match_info = tags.match(ruler, t)
    if not match:
        for (key, val) in match_info.iteritems():
            if not val:
                extras[key] = TERM.red('✖ %s' % key.title())
        extras['category'] = TERM.red('✖ Category')
    else:
        for field in ruler:
            extras[field] = TERM.green('✔ %s' % field.title())
        extras['category'] = TERM.green('✔ Category')
    return match, extras
예제 #3
0
파일: __init__.py 프로젝트: pjpony/qifqif
def check_ruler(ruler, t):
    """Build fields status dict obtained by applying ruler to transaction.
    """
    extras = {}
    match, match_info = tags.match(ruler, t)
    for (key, val) in match_info.iteritems():
        if not val:
            extras[key] = TERM.red(u'%s %s' % (TERM.KO, key.title()))
        else:
            extras[key] = TERM.green(u'%s %s' % (TERM.OK, key.title()))
    if not match:
        extras['category'] = TERM.red(u'%s Category' % TERM.KO)
    else:
        extras['category'] = TERM.green(u'%s Category' % TERM.OK)
    return match, extras
예제 #4
0
 def test_match__ruler_no_partial_match(self):
     self.assertTrue(tags.match("sully ba", TRANSACTION))
예제 #5
0
 def test_match__basic_ruler_insensitive_case(self):
     self.assertTrue(tags.match("sully bar", TRANSACTION))
예제 #6
0
 def test_match__ruler_no_partial_match(self):
     self.assertTrue(tags.match('sully ba', TRANSACTION))
예제 #7
0
 def test_match__basic_ruler_insensitive_case(self):
     self.assertTrue(tags.match('sully bar', TRANSACTION))