<commit_before>/* global describe, it, require */
'use strict';

// MODULES //

var // Expectation library:
	chai = require( 'chai' ),

	// Module to be tested:
	variance = require( './../lib/accessor.js' );


// VARIABLES //

var expect = chai.expect,
	assert = chai.assert;


// TESTS //

describe( 'accessor product', function tests() {

	it( 'should export a function', function test() {
		expect( variance ).to.be.a( 'function' );
	});

	it( 'should compute the variance using an accessor', function test() {
		var data, expected;

		data = [
			{'x':2},
			{'x':4},
			{'x':5},
			{'x':3},
			{'x':8},
			{'x':2}
		];
		expected = 5.2;

		assert.strictEqual( variance( data, getValue ), expected );

		function getValue( d ) {
			return d.x;
		}
	});

	it( 'should compute the (biased) variance using an accessor', function test() {
		var data, expected;

		data = [
			{'x':2},
			{'x':4},
			{'x':5},
			{'x':3},
			{'x':8},
			{'x':2}
		];
		expected = 4.333333333333333;

		assert.strictEqual( variance( data, getValue, true ), expected );

		function getValue( d ) {
			return d.x;
		}
	});

	it( 'should return 0 for a single element array', function test() {
		var data, expected;

		data = [ {'x':2} ];
		expected = 0;

		assert.strictEqual( variance( data, getValue ), expected );

		function getValue( d ) {
			return d.x;
		}
	});

	it( 'should return null if provided an empty array', function test() {
		assert.isNull( variance( [], getValue ) );

		function getValue( d ) {
			return d.x;
		}
	});

});
<commit_msg>[FIX] copy-paste err<commit_after>/* global describe, it, require */
'use strict';

// MODULES //

var // Expectation library:
	chai = require( 'chai' ),

	// Module to be tested:
	variance = require( './../lib/accessor.js' );


// VARIABLES //

var expect = chai.expect,
	assert = chai.assert;


// TESTS //

describe( 'accessor variance', function tests() {

	it( 'should export a function', function test() {
		expect( variance ).to.be.a( 'function' );
	});

	it( 'should compute the variance using an accessor', function test() {
		var data, expected;

		data = [
			{'x':2},
			{'x':4},
			{'x':5},
			{'x':3},
			{'x':8},
			{'x':2}
		];
		expected = 5.2;

		assert.strictEqual( variance( data, getValue ), expected );

		function getValue( d ) {
			return d.x;
		}
	});

	it( 'should compute the (biased) variance using an accessor', function test() {
		var data, expected;

		data = [
			{'x':2},
			{'x':4},
			{'x':5},
			{'x':3},
			{'x':8},
			{'x':2}
		];
		expected = 4.333333333333333;

		assert.strictEqual( variance( data, getValue, true ), expected );

		function getValue( d ) {
			return d.x;
		}
	});

	it( 'should return 0 for a single element array', function test() {
		var data, expected;

		data = [ {'x':2} ];
		expected = 0;

		assert.strictEqual( variance( data, getValue ), expected );

		function getValue( d ) {
			return d.x;
		}
	});

	it( 'should return null if provided an empty array', function test() {
		assert.isNull( variance( [], getValue ) );

		function getValue( d ) {
			return d.x;
		}
	});

});

{'fraction_non_alphanumeric': 0.18680961663417803, 'fraction_numerical': 0.021442495126705652, 'mean_word_length': 2.8974683544303796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '2447862', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1085, 'n_words': 316}