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

from jubatest import *
from jubatest.process import LocalSubprocess

import json

class JubadumpTestBase(object):
  @classmethod
  def setUpCluster(cls, env):
    cls.env = env

  def check_jubadump(self, target, cli):
    cli.save("jubadump_test")
    model_data = target.get_saved_model("jubadump_test")
    proc = LocalSubprocess(['jubadump', '--input', '/dev/stdin'])
    proc.start()

    # assert that command exits with status = 0
    self.assertEqual(proc.wait(model_data), 0)

    # assert that command prints valid JSON<commit_msg>fix integration test to display error message<commit_after>#!/usr/bin/env python
# -*- charset: utf-8 -*-

from jubatest import *
from jubatest.process import LocalSubprocess

import json

class JubadumpTestBase(object):
  @classmethod
  def setUpCluster(cls, env):
    cls.env = env

  def check_jubadump(self, target, cli):
    cli.save("jubadump_test")
    model_data = target.get_saved_model("jubadump_test")
    proc = LocalSubprocess(['jubadump', '--input', '/dev/stdin'])
    proc.start()

    # assert that command exits with status = 0
    exit_status = proc.wait(model_data)
    self.assertEqual(exit_status, 0, 'jubadump exit with status {0}: {1}'.format(exit_status, proc.stderr))

    # assert that command prints valid JSON
{'fraction_non_alphanumeric': 0.12229679343773303, 'fraction_numerical': 0.005965697240865026, 'mean_word_length': 4.102661596958175, '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': '6867073', 'n_tokens_mistral': 462, 'n_tokens_neox': 443, 'n_words': 110}