<commit_before>/*
 * Copyright 2017 <NAME> <<EMAIL>>
 *
 * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
 */

//import * as SourceMapSupport from 'source-map-support';
import * as path from 'path';
import * as nodeunit from 'nodeunit';
import * as DropPodExtension from './DropPodExtension';

//SourceMapSupport.install();

export function testContext(test: nodeunit.Test): void {
  
  const flattener = new DropPodExtension.PythonFileFlattener(path.join(__dirname, 'test_data'), ['library']);
  const result = flattener.readAndInlineCommand('command');

  test.ok(result.length !== 0, 'Test for anything');
  
  const lines = result.split('\n');
  test.equal(lines.filter(line => line.indexOf('import os') !== -1).length, 1);
  test.equal(lines.filter(line => line.indexOf('from library import *') !== -1).length, 0);
  test.equal(lines.filter(line => line.indexOf('Library run') !== -1).length, 1);
  test.equal(lines.filter(line => line.indexOf('Main run') !== -1).length, 1);<commit_msg>Fix CommandDropPodTest<commit_after>/*
 * Copyright 2017 <NAME> <<EMAIL>>
 *
 * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
 */

//import * as SourceMapSupport from 'source-map-support';
import * as path from 'path';
import * as nodeunit from 'nodeunit';
import * as DropPodExtension from './DropPodExtension';

//SourceMapSupport.install();

export function testContext(test: nodeunit.Test): void {
  
  const flattener = new DropPodExtension.PythonFileFlattener(path.join(__dirname, 'test_data'));
  const result = flattener.readAndInlineCommand('command');

  test.ok(result.length !== 0, 'Test for anything');
  
  const lines = result.split('\n');
  test.equal(lines.filter(line => line.indexOf('import os') !== -1).length, 1);
  test.equal(lines.filter(line => line.indexOf('from library import *') !== -1).length, 0);
  test.equal(lines.filter(line => line.indexOf('Library run') !== -1).length, 1);
  test.equal(lines.filter(line => line.indexOf('Main run') !== -1).length, 1);
{'fraction_non_alphanumeric': 0.16634522661523626, 'fraction_numerical': 0.01253616200578592, 'mean_word_length': 4.845070422535211, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '5102941', 'n_tokens_mistral': 644, 'n_tokens_neox': 621, 'n_words': 169}