Exemplo n.º 1
0
    def testFailingConverters(self):
        """Test PositionInfo with failing custom converters"""
        def raiseException(x, y):
            raise RuntimeError()

        positionWidget = PlotTools.PositionInfo(
            plot=self.plot,
            converters=[('Exception', raiseException)])
        self._test(positionWidget, ['Exception'], error=2)
Exemplo n.º 2
0
 def testCustomConverters(self):
     """Test PositionInfo with custom converters"""
     converters = [('Coords', lambda x, y: (int(x), int(y))),
                   ('Radius', lambda x, y: numpy.sqrt(x * x + y * y)),
                   ('Angle',
                    lambda x, y: numpy.degrees(numpy.arctan2(y, x)))]
     positionWidget = PlotTools.PositionInfo(plot=self.plot,
                                             converters=converters)
     self._test(positionWidget, ('Coords', 'Radius', 'Angle'))
Exemplo n.º 3
0
 def testDefaultConverters(self):
     """Test PositionInfo with default converters"""
     positionWidget = PlotTools.PositionInfo(plot=self.plot)
     self._test(positionWidget, ('X', 'Y'))