<commit_before>from nose.tools import with_setup
import os
import json_to_degree as jtodeg
import subprocess


class TestClass:

  @classmethod
  def setup_class(cls):
    cls.here = os.path.dirname(__file__)
    cls.data =  cls.here + '/data'

  def test_1(self):
      '''Test 1: Check that json_to_degree works when imported'''
      jtodeg.json_to_dat(self.data
          + "/json_test_in.json", output="test1.txt"
          , silent=True)
      with open("test1.txt") as file:
          gen_str = file.read()
      with open(self.data + "/json_test_out.txt") as file:
          test_str = file.read()

      assert(test_str == gen_str)
      os.remove("test1.txt")
      pass      


  def test_2(self):
      '''Test 2: Check command line execution'''
      cmd = os.path.abspath(self.here + '/../../bin/js2degree')
      print(cmd)
      subprocess.call([cmd, self.data + "/json_test_in.json", "-o=test2.txt", "-s"])
      with open("test2.txt") as file:
          gen_str = file.read()
      with open(self.data + "/json_test_out.txt") as file:
          test_str = file.read()

      assert(test_str == gen_str)
      os.remove("test2.txt")
      pass
<commit_msg>normalized import name<commit_after>from nose.tools import with_setup
import os
import json_to_degree as js2deg
import subprocess


class TestClass:

  @classmethod
  def setup_class(cls):
    cls.here = os.path.dirname(__file__)
    cls.data =  cls.here + '/data'

  def test_1(self):
      '''Test 1: Check that json_to_degree works when imported'''
      js2deg.json_to_dat(self.data
          + "/json_test_in.json", output="test1.txt"
          , silent=True)
      with open("test1.txt") as file:
          gen_str = file.read()
      with open(self.data + "/json_test_out.txt") as file:
          test_str = file.read()

      assert(test_str == gen_str)
      os.remove("test1.txt")
      pass      


  def test_2(self):
      '''Test 2: Check command line execution'''
      cmd = os.path.abspath(self.here + '/../../bin/js2degree')
      print(cmd)
      subprocess.call([cmd, self.data + "/json_test_in.json", "-o=test2.txt", "-s"])
      with open("test2.txt") as file:
          gen_str = file.read()
      with open(self.data + "/json_test_out.txt") as file:
          test_str = file.read()

      assert(test_str == gen_str)
      os.remove("test2.txt")
      pass

{'fraction_non_alphanumeric': 0.14012738853503184, 'fraction_numerical': 0.01019108280254777, 'mean_word_length': 2.4903703703703703, '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': '939758', 'n_tokens_mistral': 812, 'n_tokens_neox': 792, 'n_words': 176}