<commit_before>require_relative '../test_helper'
require_relative '../../lib/signore/mapper'
require_relative '../../lib/signore/signature'

module Signore
  describe Mapper do
    let(:sig_hash) do
      {
        'author'  => '<NAME>',
        'source'  => '/.',
        'subject' => 'on ‘Monty Wants to Save MySQL’',
        'tags'    => %w(/. MySQL),
        'text'    => text,
      }
    end
    let(:signature) do
      Signature.new(author: '<NAME>', source: '/.',
                    subject: 'on ‘Monty Wants to Save MySQL’',
                    tags: %w(/. MySQL), text: text)
    end
    let(:text) do
      'For the sake of topic titles, I’d rather if Monty saved Python.'
    end

    describe '.from_h' do
      it 'deserializes a Signature from a Hash' do
        Mapper.from_h(sig_hash).must_equal signature
      end
    end

    describe '.to_h' do
      it 'serialises a Signature to a Hash' do
        Mapper.to_h(signature).must_equal sig_hash
      end
    end
  end
end<commit_msg>port Mapper test to Expectation syntax<commit_after>require_relative '../test_helper'
require_relative '../../lib/signore/mapper'
require_relative '../../lib/signore/signature'

module Signore
  describe Mapper do
    let(:sig_hash) do
      {
        'author'  => '<NAME>',
        'source'  => '/.',
        'subject' => 'on ‘Monty Wants to Save MySQL’',
        'tags'    => %w(/. MySQL),
        'text'    => text,
      }
    end
    let(:signature) do
      Signature.new(author: '<NAME>', source: '/.',
                    subject: 'on ‘Monty Wants to Save MySQL’',
                    tags: %w(/. MySQL), text: text)
    end
    let(:text) do
      'For the sake of topic titles, I’d rather if Monty saved Python.'
    end

    describe '.from_h' do
      it 'deserializes a Signature from a Hash' do
        _(Mapper.from_h(sig_hash)).must_equal signature
      end
    end

    describe '.to_h' do
      it 'serialises a Signature to a Hash' do
        _(Mapper.to_h(signature)).must_equal sig_hash
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.13228809407153355, 'fraction_numerical': 0.0, 'mean_word_length': 2.0117994100294987, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2823421', 'n_tokens_mistral': 650, 'n_tokens_neox': 639, 'n_words': 192}