示例#1
0
    def test_get_new_tokens(self):
        tokens = TokenRegistry()

        # First, register four new tokens and make sure they get the
        # expected ids.
        for token_id, token in enumerate(u"this is a test".split()):
            self.assertEquals(chr(token_id), tokens.get_id(token))

        # Then, repeat the same check to make sure they aren't
        # re-registered.
        for token_id, token in enumerate(u"this is a test".split()):
            self.assertEquals(chr(token_id), tokens.get_id(token))
示例#2
0
文件: test_model.py 项目: wodim/cobe
    def test_get_new_tokens(self):
        tokens = TokenRegistry()

        # First, register four new tokens and make sure they get the
        # expected ids.
        for token_id, token in enumerate(u"this is a test".split()):
            self.assertEquals(chr(token_id), tokens.get_id(token))

        # Then, repeat the same check to make sure they aren't
        # re-registered.
        for token_id, token in enumerate(u"this is a test".split()):
            self.assertEquals(chr(token_id), tokens.get_id(token))
示例#3
0
    def test_non_unicode(self):
        # Test the Unicode-checking entry points in TokenRegistry
        tokens = TokenRegistry()

        with self.assertRaises(TypeError):
            tokens.get_id("non-unicode")
示例#4
0
文件: test_model.py 项目: wodim/cobe
    def test_non_unicode(self):
        # Test the Unicode-checking entry points in TokenRegistry
        tokens = TokenRegistry()

        with self.assertRaises(TypeError):
            tokens.get_id("non-unicode")