<commit_before># -*- encoding : utf-8 -*-

require 'spec_helper'

describe WeatherData::Temperature do
  describe "extends Integer" do
    let(:number) { Integer(0) }

    {
      celsius:    WeatherData::Temperature::Celsius,
      fahrenheit: WeatherData::Temperature::Fahrenheit,
      kelvin:     WeatherData::Temperature::Kelvin
    }.each do |method_name, klass|
      it "adds #{method_name}" do
        expect(number).to respond_to(method_name)
      end

      it "#{method_name} returns an instance of #{klass.name}" do
        expect(number.public_send(method_name)).to be_kind_of(klass)
      end
    end
  end

  describe "extends Float" do
    let(:number) { Float(0) }

    {
      celsius:    WeatherData::Temperature::Celsius,
      fahrenheit: WeatherData::Temperature::Fahrenheit,
      kelvin:     WeatherData::Temperature::Kelvin
    }.each do |method_name, klass|
      it "adds #{method_name}" do
        expect(number).to respond_to(method_name)
      end

      it "#{method_name} returns an instance of #{klass.name}" do
        expect(number.public_send(method_name)).to be_kind_of(klass)
      end
    end
  end

  describe "#parse" do
    it "parses temperature in Celsius" do
      [15.2, -15.2].each do |deg|
        ["#{deg} °C", "#{deg}°C", "#{deg}C", "#{deg} C"].each do |s|
          t = subject.parse(s)
          expect(t).to be_kind_of WeatherData::Temperature::Celsius<commit_msg>Using rockets for hashes to support 1.8.7<commit_after># -*- encoding : utf-8 -*-

require 'spec_helper'

describe WeatherData::Temperature do
  describe "extends Integer" do
    let(:number) { Integer(0) }

    {
      :celsius    => WeatherData::Temperature::Celsius,
      :fahrenheit => WeatherData::Temperature::Fahrenheit,
      :kelvin     => WeatherData::Temperature::Kelvin
    }.each do |method_name, klass|
      it "adds #{method_name}" do
        expect(number).to respond_to(method_name)
      end

      it "#{method_name} returns an instance of #{klass.name}" do
        expect(number.public_send(method_name)).to be_kind_of(klass)
      end
    end
  end

  describe "extends Float" do
    let(:number) { Float(0) }

    {
      :celsius    => WeatherData::Temperature::Celsius,
      :fahrenheit => WeatherData::Temperature::Fahrenheit,
      :kelvin     => WeatherData::Temperature::Kelvin
    }.each do |method_name, klass|
      it "adds #{method_name}" do
        expect(number).to respond_to(method_name)
      end

      it "#{method_name} returns an instance of #{klass.name}" do
        expect(number.public_send(method_name)).to be_kind_of(klass)
      end
    end
  end

  describe "#parse" do
    it "parses temperature in Celsius" do
      [15.2, -15.2].each do |deg|
        ["#{deg} °C", "#{deg}°C", "#{deg}C", "#{deg} C"].each do |s|
          t = subject.parse(s)
          expect(t).to be_kind_of WeatherData::Temperature::Celsius
{'fraction_non_alphanumeric': 0.13592233009708737, 'fraction_numerical': 0.007281553398058253, 'mean_word_length': 2.9793103448275864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7304509', 'n_tokens_mistral': 988, 'n_tokens_neox': 959, 'n_words': 217}