mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	Instrument/MeasurementType: Allow for converting to the same type
When trying to convert measurments to a standarised type some inputs may already be of the correct type and will now return the same value unchanged.
This commit is contained in:
		@@ -48,6 +48,8 @@ class MeasurementType(object):
 | 
			
		||||
        if not isinstance(to, MeasurementType):
 | 
			
		||||
            msg = 'Unexpected conversion target: "{}"'
 | 
			
		||||
            raise ValueError(msg.format(to))
 | 
			
		||||
        if to.name == self.name:
 | 
			
		||||
            return value
 | 
			
		||||
        if not to.name in self.conversions:
 | 
			
		||||
            msg = 'No conversion from {} to {} available'
 | 
			
		||||
            raise ValueError(msg.format(self.name, to.name))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user