<commit_before>context 'LINDEX' do
  setup do
    @db = Moneta.new :Memory
    @db.lpush 'test:lindex', 'foo'
    @db.lpush 'test:lindex', 'bar'
    @db.lpush 'test:lindex', 'baz'
  end

  test 'when list does not exist' do
    assert_equal nil, @db.lindex('test:nx', 1)
  end

  context 'when list exists' do
    test 'index in range' do
      assert_equal 'bar', @db.lindex('test:lindex', 1)
    end

    test 'index out of range' do
      assert_equal nil, @db.lindex('test:lindex', 999)
    end
  end

  teardown { @db.close }
end
<commit_msg>More readaable tests.<commit_after>context 'LINDEX' do
  setup do
    @db = Moneta.new :Memory
  end

  given 'an empty list' do
    should 'return nothing' do
      assert_equal nil, @db.lindex('test:nx', 1)
    end
  end

  given 'a list with 3 items' do
    setup do
      @db.lpush 'test:lindex', 'foo'
      @db.lpush 'test:lindex', 'bar'
      @db.lpush 'test:lindex', 'baz'
    end

    context 'a request for an index within range' do
      should 'return the item at that index' do
        assert_equal 'bar', @db.lindex('test:lindex', 1)
      end
    end

    context 'a request for an index out of range' do
      should 'return nothing' do
        assert_equal nil, @db.lindex('test:lindex', 999)
      end
    end
  end

  teardown { @db.close }
end

{'fraction_non_alphanumeric': 0.11823035850495804, 'fraction_numerical': 0.008390541571319604, 'mean_word_length': 2.634349030470914, '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': '4017662', 'n_tokens_mistral': 489, 'n_tokens_neox': 466, 'n_words': 152}