SynBioDex / pySBOL2

A pure Python implementation of the SBOL standard.
Apache License 2.0
20 stars 6 forks source link

Properties do not accept math.inf as an upper bound #354

Closed tcmitchell closed 4 years ago

tcmitchell commented 4 years ago

Properties can have an infinite upper bound, usually represented as an asterisk: '*'. In addition to using strings for the lower and upper bounds, both ints and floats can also be used. math.inf, however, is not considered a valid value. When passed:

Traceback (most recent call last):
  File "/Users/tmitchel/Projects/sd2/pySBOL2/examples/pr353.py", line 36, in <module>
    sample = MySample('mysample1')
  File "/Users/tmitchel/Projects/sd2/pySBOL2/examples/pr353.py", line 24, in __init__
    self.sequences = sbol2.OwnedObject(self, sbol2.SBOL_SEQUENCE_PROPERTY,
  File "/Users/tmitchel/Projects/sd2/pySBOL2/sbol2/property.py", line 555, in __init__
    super().__init__(property_owner, sbol_uri, lower_bound, upper_bound,
  File "/Users/tmitchel/Projects/sd2/pySBOL2/sbol2/property.py", line 98, in __init__
    self._upperBound = Property.valid_upper_bound(upper_bound)
  File "/Users/tmitchel/Projects/sd2/pySBOL2/sbol2/property.py", line 63, in valid_upper_bound
    raise ValueError('Upper bound must be numeric or \'*\'')
ValueError: Upper bound must be numeric or '*'

Allow math.inf to be used as an infinite upper bound. math.inf is not a valid value for lower bound, so it should still be unacceptable there.