<commit_before>from unittest import TestCase
from net.wyun.mer.ink.sample import Sample
from scipy import misc

import numpy as np

'''
all tests in this module and test_stroke.py are base on file data/inkml/65_alfonso.inkml
'''


class TestSample(TestCase):
    def setUp(self):
        self.idd = Sample('data/inkml/65_alfonso.inkml')
        self.stroke0 = self.idd.traces[0]
        self.stroke1 = self.idd.traces[1]
        self.stroke2 = self.idd.traces[2]
        prev = self.idd.traces[1]


    def test_get_bounding_box_h1000(self):
        self.assertEqual((0, 0, 69622, 10000), (self.idd.ox, self.idd.oy, self.idd.os, self.idd.ot))

    def test_getAVGstroke_size(self):
        avgW, avgH = self.idd.getAVGstroke_size()<commit_msg>add inkml file loading test.<commit_after>from unittest import TestCase
from net.wyun.mer.ink.sample import Sample
from scipy import misc

import numpy as np

'''
all tests in this module and test_stroke.py are base on file data/inkml/65_alfonso.inkml
'''


class TestSample(TestCase):
    def setUp(self):
        self.idd = Sample('data/inkml/65_alfonso.inkml')
        self.stroke0 = self.idd.traces[0]
        self.stroke1 = self.idd.traces[1]
        self.stroke2 = self.idd.traces[2]
        prev = self.idd.traces[1]

    def test_inkml_loading(self):
        print 'loading inkml'
        print 'latex: ', self.idd.latex


    def test_get_bounding_box_h1000(self):
        self.assertEqual((0, 0, 69622, 10000), (self.idd.ox, self.idd.oy, self.idd.os, self.idd.ot))

    def test_getAVGstroke_size(self):
        avgW, avgH = self.idd.getAVGstroke_size()
{'fraction_non_alphanumeric': 0.11830635118306351, 'fraction_numerical': 0.033623910336239106, 'mean_word_length': 3.1848958333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '7466144', 'n_tokens_mistral': 609, 'n_tokens_neox': 567, 'n_words': 125}