<commit_before>require 'spec_helper'

module Cb
  module Models
    describe DataLists::DataListBase do
      let(:key) { 'key' }
      let(:value) { 'value' }
      let(:data_list) { DataLists::DataListBase.new(args) }

      let(:error) do
        begin
          data_list
        rescue ExpectedResponseFieldMissing => e
          e.message
        end
      end

      context 'valid arguments' do
        let(:args) { { key => key, value => value } }

        it { expect(data_list.key).to eql(key) }
        it { expect(data_list.value).to eql(value) }
      end

      context 'invalid key' do
        let(:args) { { 'invalid_key' => key, value => value } }

        it { expect(error).to eq(key) }
      end

      context 'invalid value' do
        let(:args) { { key => key, 'invalid_value' => value } }

        it { expect(error).to eq(value) }
      end

      context 'no args' do
        let(:args) { {} }

        it { expect(error).to eq(key + ' ' + value) }
      end
    end
  end
end
<commit_msg>refactored base<commit_after>require 'spec_helper'

module Cb
  module Models
    describe DataLists::DataListBase do
      subject { DataLists::DataListBase.new(args) }
      let(:key) { 'key' }
      let(:value) { 'value' }

      let(:error) do
        begin
          subject
        rescue ExpectedResponseFieldMissing => e
          e.message
        end
      end

      context 'valid arguments' do
        let(:args) { { key => key, value => value } }

        it { expect(subject.key).to eql(key) }
        it { expect(subject.value).to eql(value) }
      end

      context 'invalid key' do
        let(:args) { { 'invalid_key' => key, value => value } }

        it { expect(error).to eq(key) }
      end

      context 'invalid value' do
        let(:args) { { key => key, 'invalid_value' => value } }

        it { expect(error).to eq(value) }
      end

      context 'no args' do
        let(:args) { {} }

        it { expect(error).to eq(key + ' ' + value) }
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.13006923837784373, 'fraction_numerical': 0.0, 'mean_word_length': 1.9066091954022988, 'pattern_counts': {'":': 0, '<': 3, '<?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': '372994', 'n_tokens_mistral': 653, 'n_tokens_neox': 630, 'n_words': 161}