def test_decode_nibbles_fixed_partial() -> None:
    'Fixed field is provided partially'
    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'
    s = b'020040000000000000001'
    with pytest.raises(iso8583.DecodeError, match='Field data is 2 nibbles, expecting 4: field 2 pos 20'):
        iso8583.decode(s, spec=spec)
Fixed field is provided partially
def test_decode_nibbles_fixed_partial() -> 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'
    s = b'020040000000000000001'
    with pytest.raises(iso8583.DecodeError, match='Field data is 2 nibbles, expecting 4: field 2 pos 20'):
        iso8583.decode(s, spec=spec)