<commit_before>describe CardParser, '#parse' do
  
  inputs = {
    '2H' => {
      :value => 2,
      :suit => Suit::HEARTS
    },
    '2D' => {
      :value => 2,
      :suit => Suit::DIAMONDS
    },
    '2C' => {
      :value => 2,
      :suit => Suit::CLUBS
    },
    '2S' => {
      :value => 2,
      :suit => Suit::SPADES
    },
    'TH' => {
      :value => 10,
      :suit => Suit::HEARTS
    },
    'JH' => {
      :value => 11,
      :suit => Suit::HEARTS
    },
    'QH' => {
      :value => 12,
      :suit => Suit::HEARTS
    },
    'KH' => {
      :value => 13,
      :suit => Suit::HEARTS
    },
    'AH' => {
      :value => 14,
      :suit => Suit::HEARTS
    },
  }
  
  inputs.each do |input, v|
    context "given #{input}" do
      it "creates a valid card" do
        card = CardParser.parse input
        expect(card.value).to eq(v[:value])
        expect(card.suit).to eq(v[:suit])
      end
    end
  end
  
  context 'given invalid input value BH' do
    it 'does not create a card' do
      card = CardParser.parse 'BH'
      expect(card).to be_nil
    end
  end
  
  context 'given invalid input value 1H' do
    it 'does not create a card' do
      card = CardParser.parse '1H'
      expect(card).to be_nil
    end
  end
  
  context 'given invalid input suit 9M' do
    it 'does not create a card' do
      card = CardParser.parse '9M'
      expect(card).to be_nil
    end
  end
  
end<commit_msg>Refactor card parser tests<commit_after>describe CardParser, '#parse' do
  
  inputs = {
    '2H' => {
      :value => 2,
      :suit => Suit::HEARTS
    },
    '2D' => {
      :value => 2,
      :suit => Suit::DIAMONDS
    },
    '2C' => {
      :value => 2,
      :suit => Suit::CLUBS
    },
    '2S' => {
      :value => 2,
      :suit => Suit::SPADES
    },
    'TH' => {
      :value => 10,
      :suit => Suit::HEARTS
    },
    'JH' => {
      :value => 11,
      :suit => Suit::HEARTS
    },
    'QH' => {
      :value => 12,
      :suit => Suit::HEARTS
    },
    'KH' => {
      :value => 13,
      :suit => Suit::HEARTS
    },
    'AH' => {
      :value => 14,
      :suit => Suit::HEARTS
    },
  }
  
  inputs.each do |input, v|
    context "given #{input}" do
      it "creates a valid card" do
        card = CardParser.parse input
        expect(card.value).to eq(v[:value])
        expect(card.suit).to eq(v[:suit])
      end
    end
  end
  
  ['BH', '1H', '9M'].each do |input|
    context "given invalid input #{input}" do
      it 'does not create a card' do
        card = CardParser.parse input
        expect(card).to be_nil
      end
    end
  end
  
end
{'fraction_non_alphanumeric': 0.16411042944785276, 'fraction_numerical': 0.016104294478527608, 'mean_word_length': 1.6896907216494845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 57, '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': '5183380', 'n_tokens_mistral': 1017, 'n_tokens_neox': 951, 'n_words': 241}