<commit_before># vim: tabstop=4 shiftwidth=4 softtabstop=4
"""
Test of converter utility
"""

import logging
import os
import sys
import unittest

from opengem import converter
from opengem import test
from opengem import flags
FLAGS = flags.FLAGS

NSHML_DIR = 'usgs-nshm'
NSHML_URL = "https://github.com/gem/usgs-nshm.git"

OUTPUT_DIR = 'output'

class ConverterTestCase(unittest.TestCase):
    """Tests converting NSHMP to NRML"""
    def setUp(self):
        self.dir = os.path.join(test.DATA_DIR, NSHML_DIR)
        self.file = os.path.join(test.DATA_DIR, OUTPUT_DIR)
        if not os.path.exists(self.file):
            os.path.mkdir(self.file)
        #test.guarantee_file(self.file, TEST_FILE_URL)
    
    # For coverage of the converter, please run demo_converter.sh
    @test.skipit
    def test_converter_output_is_nrml(self):
        input_path = self.dir
        
        # Extendable with plugins
        input_type = "opengem.parser.nshmp"
        output_type = "opengem.parser.nrml"
        __import__(input_type)
        __import__(output_type)
        input_module = sys.modules[input_type]
        output_module = sys.modules[output_type]
        
        output_path = self.file
        converter.convert(input_path, input_module,
                            output_path, output_module)
        
        self.assertTrue(True)

<commit_msg>Fixin stupid typos.<commit_after># vim: tabstop=4 shiftwidth=4 softtabstop=4
"""
Test of converter utility
"""

import logging
import os
import sys
import unittest

from opengem import converter
from opengem import test
from opengem import flags
FLAGS = flags.FLAGS

NSHML_DIR = 'usgs-nshm'
NSHML_URL = "https://github.com/gem/usgs-nshm.git"

OUTPUT_DIR = 'output'

class ConverterTestCase(unittest.TestCase):
    """Tests converting NSHMP to NRML"""
    def setUp(self):
        self.dir = os.path.join(test.DATA_DIR, NSHML_DIR)
        self.file = os.path.join(test.DATA_DIR, OUTPUT_DIR)
        if not os.path.exists(self.file):
            os.makedirs(self.file)
        #test.guarantee_file(self.file, TEST_FILE_URL)
    
    # For coverage of the converter, please run demo_converter.sh
    @test.skipit
    def test_converter_output_is_nrml(self):
        input_path = self.dir
        
        # Extendable with plugins
        input_type = "opengem.parser.nshmp"
        output_type = "opengem.parser.nrml"
        __import__(input_type)
        __import__(output_type)
        input_module = sys.modules[input_type]
        output_module = sys.modules[output_type]
        
        output_path = self.file
        converter.convert(input_path, input_module,
                            output_path, output_module)
        
        self.assertTrue(True)


{'fraction_non_alphanumeric': 0.09104258443465492, 'fraction_numerical': 0.0022026431718061676, 'mean_word_length': 2.737997256515775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5753038', 'n_tokens_mistral': 900, 'n_tokens_neox': 893, 'n_words': 184}