Sha256: 69d5aaa7b2a4462501889c84ed435ead01a819ce5357b260b82cd554f153a02f

Contents?: true

Size: 972 Bytes

Versions: 3

Compression:

Stored size: 972 Bytes

Contents

require 'spec_helper'
require 'python/pickle/protocol3'

require 'protocol0_read_instruction_examples'
require 'protocol1_read_instruction_examples'
require 'protocol2_read_instruction_examples'
require 'protocol3_read_instruction_examples'

describe Python::Pickle::Protocol3 do
  let(:pickle) { '' }
  let(:io) { StringIO.new(pickle) }

  subject { described_class.new(io) }

  describe "#read_instruction" do
    include_context "Protocol0#read_instruction examples"
    include_context "Protocol1#read_instruction examples"
    include_context "Protocol2#read_instruction examples"
    include_context "Protocol3#read_instruction examples"

    context "when the opcode is not recognized" do
      let(:opcode) { 255 }
      let(:io)     { StringIO.new(opcode.chr) }

      it do
        expect {
          subject.read_instruction
        }.to raise_error(Python::Pickle::InvalidFormat,"invalid opcode (#{opcode.inspect}) for protocol 3")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
python-pickle-0.2.0 spec/protocol3_spec.rb
python-pickle-0.1.1 spec/protocol3_spec.rb
python-pickle-0.1.0 spec/protocol3_spec.rb