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
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
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
def test_match__ruler_no_partial_match(self): self.assertTrue(tags.match("sully ba", TRANSACTION))
def test_match__basic_ruler_insensitive_case(self): self.assertTrue(tags.match("sully bar", TRANSACTION))
def test_match__ruler_no_partial_match(self): self.assertTrue(tags.match('sully ba', TRANSACTION))
def test_match__basic_ruler_insensitive_case(self): self.assertTrue(tags.match('sully bar', TRANSACTION))