<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest
import types
import sys
from mecabwrap.api import tokenize, str_token, mecab_batch, mecab_batch_iter, Token


class TestTokenize(unittest.TestCase):
    def test_tokenize(self):
        tokens = tokenize(u'すもももももももものうち')
        words = [a.surface for a in tokens]
        self.assertEqual(
            words, 
            [u'すもも', u'も', u'もも', u'も', u'もも', u'の', u'うち']
         )

    def test_print_str(self):
        """
        print(token) should give str in both in python2 and 3
        """
        tokens = tokenize(u'すもももももももものうち')
        for token in tokens:
            s = str_token(token)
            self.assertTrue(isinstance(s, str))

class TestBatch(unittest.TestCase):
    def test_batch(self):
        x = [u"明日は晴れるかな", u"雨なら読書をしよう"]
        y = mecab_batch(x)
        self.assertEqual(len(x), len(y))
        
        for a in y:
            self.assertEqual(type(a), list)
            for b in a:
                self.assertEqual(type(b), Token)
    
    def test_format(self):
        x = [u"明日は晴れるかな", u"雨なら読書をしよう"]<commit_msg>remove unsupported test<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest
import types
import sys
from mecabwrap.api import tokenize, str_token, mecab_batch, mecab_batch_iter, Token


class TestTokenize(unittest.TestCase):
    def test_tokenize(self):
        tokens = tokenize(u'すもももももももものうち')
        words = [a.surface for a in tokens]
        self.assertEqual(
            words, 
            [u'すもも', u'も', u'もも', u'も', u'もも', u'の', u'うち']
         )


class TestBatch(unittest.TestCase):
    def test_batch(self):
        x = [u"明日は晴れるかな", u"雨なら読書をしよう"]
        y = mecab_batch(x)
        self.assertEqual(len(x), len(y))
        
        for a in y:
            self.assertEqual(type(a), list)
            for b in a:
                self.assertEqual(type(b), Token)
    
    def test_format(self):
        x = [u"明日は晴れるかな", u"雨なら読書をしよう"]
{'fraction_non_alphanumeric': 0.127936031984008, 'fraction_numerical': 0.001999000499750125, 'mean_word_length': 2.2394822006472492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3171825', 'n_tokens_mistral': 760, 'n_tokens_neox': 745, 'n_words': 157}