Exemplo n.º 1
0
class TestMinorTickGenerator(unittest.TestCase):

    def setUp(self):
        self.tick_generator = MinorTickGenerator()

    def test_minor_tick_generator_with_interval(self):
        """If the MinorTickGenerator is not given an interval of 'auto',
        it should return the same results as a DefaultTickGenerator
        """
        self.default_tick_generator = DefaultTickGenerator()
        
        high = 1.0
        low = 0.0
        
        intervals = [0.05, 0.1, 0.2, 0.25, 0.5]
        
        for i in intervals:
            ticksMinor = self.tick_generator.get_ticks(
                data_low=0,
                data_high=1,
                bounds_low=low,
                bounds_high=high,
                interval=i,
            )
            ticksDefault = self.default_tick_generator.get_ticks(
                data_low=0,
                data_high=1,
                bounds_low=low,
                bounds_high=high,
                interval=i,
            )
            self.assertEqual(ticksMinor.tolist(), ticksDefault.tolist())
    
    def test_minor_tick_generator_without_interval(self):
        """A minor tick generator should return more ticks than
        the default tick generator.
        """
        self.default_tick_generator = DefaultTickGenerator()
        
        high = 1.0
        low = 0.0
        
        ticksMinor = self.tick_generator.get_ticks(
            data_low=0,
            data_high=1,
            bounds_low=low,
            bounds_high=high,
            interval='auto',
        )
        ticksDefault = self.default_tick_generator.get_ticks(
            data_low=0,
            data_high=1,
            bounds_low=low,
            bounds_high=high,
            interval='auto',
        )
        
        self.assertGreater(len(ticksMinor), len(ticksDefault))
Exemplo n.º 2
0
class TestMinorTickGenerator(unittest.TestCase):
    def setUp(self):
        self.tick_generator = MinorTickGenerator()

    def test_minor_tick_generator_with_interval(self):
        """If the MinorTickGenerator is not given an interval of 'auto',
        it should return the same results as a DefaultTickGenerator
        """
        self.default_tick_generator = DefaultTickGenerator()

        high = 1.0
        low = 0.0

        intervals = [0.05, 0.1, 0.2, 0.25, 0.5]

        for i in intervals:
            ticksMinor = self.tick_generator.get_ticks(
                data_low=0,
                data_high=1,
                bounds_low=low,
                bounds_high=high,
                interval=i,
            )
            ticksDefault = self.default_tick_generator.get_ticks(
                data_low=0,
                data_high=1,
                bounds_low=low,
                bounds_high=high,
                interval=i,
            )
            self.assertEqual(ticksMinor.tolist(), ticksDefault.tolist())

    def test_minor_tick_generator_without_interval(self):
        """A minor tick generator should return more ticks than
        the default tick generator.
        """
        self.default_tick_generator = DefaultTickGenerator()

        high = 1.0
        low = 0.0

        ticksMinor = self.tick_generator.get_ticks(
            data_low=0,
            data_high=1,
            bounds_low=low,
            bounds_high=high,
            interval='auto',
        )
        ticksDefault = self.default_tick_generator.get_ticks(
            data_low=0,
            data_high=1,
            bounds_low=low,
            bounds_high=high,
            interval='auto',
        )

        self.assertGreater(len(ticksMinor), len(ticksDefault))
Exemplo n.º 3
0
 def setUp(self):
     self.tick_generator = MinorTickGenerator()
Exemplo n.º 4
0
 def setUp(self):
     self.tick_generator = MinorTickGenerator()