<commit_before>/* tslint:disable:quotemark */

import {assert} from 'chai';
import {parseModel} from '../util';
import {X} from '../../src/channel';

describe('Model', function() {
  describe('timeFormat()', function() {
    it('should get the right time template', function() {
      assert.equal(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'month', field:'a', type: "temporal", axis: {shortTimeLabels: true}}
        }
      }).timeFormat(X), '%b');

      assert.equal(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'month', field:'a', type: "temporal"}
        }
      }).timeFormat(X), '%B');

      assert.equal(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'week', field:'a', type: "temporal", axis: {shortTimeLabels: true}}
        }
      }).timeFormat(X), undefined);
    });
  });

  describe('format()', function() {
    it('should use time format type for time scale', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'month', field:'a', type: "temporal"}
        }
      }).format(X, undefined), {
        formatType: 'time',
        format: '%B'
      });
    });

    it('should use default time format if we don\'t have a good format', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'week', field:'a', type: "temporal"}
        }
      }).format(X, undefined), {
        formatType: 'time',
        format: '%Y-%m-%d'
      });
    });

    it('should use number format for quantitative scale', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {field:'a', type: "quantitative"}
        }
      }).format(X, undefined), {
        format: 's'
      });
    });

    it('should use format if provided', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {field:'a', type: "quantitative"}
        }
      }).format(X, 'foo'), {
        format: 'foo'
      });
    });<commit_msg>Fix test<commit_after>/* tslint:disable:quotemark */

import {assert} from 'chai';
import {parseModel} from '../util';
import {X} from '../../src/channel';

describe('Model', function() {
  describe('timeFormat()', function() {
    it('should get the right time template', function() {
      assert.equal(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'month', field:'a', type: "temporal", axis: {shortTimeLabels: true}}
        }
      }).timeFormat(X), '%b');

      assert.equal(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'month', field:'a', type: "temporal"}
        }
      }).timeFormat(X), '%B');

      assert.equal(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'week', field:'a', type: "temporal", axis: {shortTimeLabels: true}}
        }
      }).timeFormat(X), undefined);
    });
  });

  describe('format()', function() {
    it('should use time format type for time scale', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'month', field:'a', type: "temporal"}
        }
      }).format(X, undefined), {
        formatType: 'time',
        format: '%B'
      });
    });

    it('should use default time format if we don\'t have a good format', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {timeUnit: 'week', field:'a', type: "temporal"}
        }
      }).format(X, undefined), {
        formatType: 'time',
        format: '%Y-%m-%d'
      });
    });

    it('should use number format for quantitative scale', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {field:'a', type: "quantitative"}
        },
        config: {
          numberFormat: 'foo'
        }
      }).format(X, undefined), {
        format: 'foo'
      });
    });

    it('should use format if provided', function() {
      assert.deepEqual(parseModel({
        mark: "point",
        encoding: {
          x: {field:'a', type: "quantitative"}
        }
      }).format(X, 'foo'), {
        format: 'foo'
      });
    });
{'fraction_non_alphanumeric': 0.18280313508529275, 'fraction_numerical': 0.0, 'mean_word_length': 2.1419261404779144, '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': '2944061', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1283, 'n_words': 326}