예제 #1
0
파일: matchex.py 프로젝트: m3047/trualias
    def test_code_first(self):
        """Code as the first token."""
        alias = parse("""
            ACCOUNT foo
            MATCHES %code%-%ident%-%account%
            WITH CHARS(1),ANY();
        """)[0]
        matches = alias.match('3a-bar-foo')

        self.assertEqual(len(matches),1)
        self.assertEqual(len(matches[0].matches),1)
        self.assertFalse(matches[0].ambiguous())
        self.assertEqual(matches[0].delivery_account(),'foo')

        return
예제 #2
0
파일: matchex.py 프로젝트: m3047/trualias
    def test_alias_match(self):
        """Call Alias.match()"""
        alias = parse("""
            ACCOUNT foo
            MATCHES %account%-%ident%-%code%
            WITH CHARS(1),ANY();
        """)[0]
        matches = alias.match('foo-bar-3a')

        self.assertEqual(len(matches),1)
        self.assertEqual(len(matches[0].matches),1)
        self.assertFalse(matches[0].ambiguous())
        self.assertEqual(matches[0].delivery_account(),'foo')

        return