<commit_before>/* global describe, it, beforeEach */

var expect = require('chai').expect

var dtype = require('../lib/datatype')
var translator = require('../lib/translator')

describe('Translator', function () {
  var t
  beforeEach(function () {
    var pointXY = dtype.descriptor('PointXY', {x: 0, y: 0})
    var pointRPhi = dtype.descriptor('PointRPhi', {r: 0, phi: 0})
    t = translator.create(pointXY, pointRPhi)
  })

  it('Can create a new translator between two types', function () {
    expect(translator.from(t)).to.equal('PointXY')
    expect(translator.to(t)).to.equal('PointRPhi')
  })
})<commit_msg>(test) Check whether an error is thrown if a name clash occurs.<commit_after>/* global describe, it, beforeEach */

var expect = require('chai').expect

var dtype = require('../lib/datatype')
var translator = require('../lib/translator')

describe('Translator', function () {
  var t
  beforeEach(function () {
    var pointXY = dtype.descriptor('PointXY', {x: 0, y: 0})
    var pointRPhi = dtype.descriptor('PointRPhi', {r: 0, phi: 0})
    t = translator.create(pointXY, pointRPhi)
  })

  it('Can create a new translator between two types', function () {
    expect(translator.from(t)).to.equal('PointXY')
    expect(translator.to(t)).to.equal('PointRPhi')
  })
  it('Complains if a name clash occurs', function () {
    var t1 = dtype.descriptors('A', {})
    var t2 = dtype.descriptors('A', {different: 'bool'})
    expect(function () { dtype.translators(t1, t2) }).to.throw.an(Error)
  })
})
{'fraction_non_alphanumeric': 0.1746031746031746, 'fraction_numerical': 0.007936507936507936, 'mean_word_length': 4.14625850340136, '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': '6300236', 'n_tokens_mistral': 512, 'n_tokens_neox': 492, 'n_words': 124}