Skip to content
  • Andrew Hankinson's avatar
    Create Indicators type · ea843bfb
    Andrew Hankinson authored and Ed Summers's avatar Ed Summers committed
    Previously, indicators of any length could be supplied with no checks on their length. This change introduces an "Indicators" named tuple that can only have two positions. If an iterable (list or tuple) of not exactly length two is passed, then a ValueError is now raised.
    
    The "old style" where a list of two elements are passed is still handled in the constructor; however, the type hints will indicate that this is not correct. (This is in preference to raising a Deprecation message). Internally this is coerced to the new named tuple type.
    
    If no indicator is passed, the value will be an indicator tuple with two space characters. As far as I can tell this was the default behaviour of pymarc previously.
    
    Tests are also updated to work with the new Indicator types, with tests for the old behaviour also added.
    
    Fixes #195
    ea843bfb
To learn more about this project, read the wiki.