def test_encode_nibbles_fixed_missing() -> None:
    'Fixed field is missing'
    spec = copy.deepcopy(iso8583.specs.default)
    spec['t']['data_enc'] = 'ascii'
    spec['p']['data_enc'] = 'ascii'
    spec['2']['data_enc'] = 'ascii'
    spec['2']['len_enc'] = 'ascii'
    spec['2']['len_type'] = 0
    spec['2']['max_len'] = 4
    spec['2']['len_count'] = 'nibbles'
    decoded = {'t': '0200', '2': ''}
    with pytest.raises(iso8583.EncodeError, match='Field data is 0 nibbles, expecting 4: field 2'):
        iso8583.encode(decoded, spec=spec)
Fixed field is missing
def test_encode_nibbles_fixed_missing() -> None:
    
    spec = copy.deepcopy(iso8583.specs.default)
    spec['t']['data_enc'] = 'ascii'
    spec['p']['data_enc'] = 'ascii'
    spec['2']['data_enc'] = 'ascii'
    spec['2']['len_enc'] = 'ascii'
    spec['2']['len_type'] = 0
    spec['2']['max_len'] = 4
    spec['2']['len_count'] = 'nibbles'
    decoded = {'t': '0200', '2': }
    with pytest.raises(iso8583.EncodeError, match='Field data is 0 nibbles, expecting 4: field 2'):
        iso8583.encode(decoded, spec=spec)