Exemple #1
0
    def test_shaders(self):
        shaders = [
            (ar_downsample.BinarySegment(low=1, high=2, divider=10),
             numeric.BinarySegment, {}),
            (ar_downsample.Contour(), contour.Contour, {}),
            (ar_downsample.Cuberoot(), numeric.Cuberoot, {}),
            (ar_downsample.HDAlpha(), categories.HDAlpha, {}),
            (ar_downsample.Id(), general.Id, {}),
            (ar_downsample.Interpolate(low=0,
                                       high=10), numeric.Interpolate, {}),
            (ar_downsample.InterpolateColor(low=(10, 10, 10),
                                            high=(200, 200, 200),
                                            reserve=(0, 0, 0),
                                            empty=-1),
             numeric.InterpolateColors, {}),
            (ar_downsample.Log(), npg.Log10, {}),
            (ar_downsample.NonZeros(), categories.NonZeros, {}),
            (ar_downsample.Ratio(), categories.Ratio, {}),
            (ar_downsample.Seq(first=ar_downsample.Id(),
                               second=ar_downsample.Sqrt()), ar.Seq, {}),
            (ar_downsample.Spread(factor=2), npg.Spread, {}),
            (ar_downsample.Sqrt(), numeric.Sqrt, {}),
            (ar_downsample.ToCounts(), categories.ToCounts, {}),
        ]

        for (shader, target, kwargs) in shaders:
            self._shader_tester(shader, target, kwargs)
 def test_init_AR(self):
     # simulate un-loading AR.. this test fails if ar is imported elsewhere before
     # this test is run
     if 'general' in ar_downsample.__dict__:
         ar_downsample.__dict__.pop('general')
     self.assertRaises(NameError, ar_downsample.Id().reify)
     ar_downsample._loadAR()
     self.assertIsNotNone(ar_downsample.Id().reify())
Exemple #3
0
    def _shader_tester(self, proxy, reify_base, kwargs):
        self.assertIn(proxy.out, ["image", "image_rgb", "multi_line"],
                      "Unknown output type.")

        self.assertIsNotNone(proxy.reformat(None), "No reformat provided")

        op2 = proxy + ar_downsample.Id()
        self.assertIsNotNone(op2)
        self.assertIsInstance(op2, ar_downsample.Seq,
                              "Unexpected result from sequencing")

        self._reify_tester(proxy, reify_base, kwargs)
Exemple #4
0
 def test_init_AR(self):
     self.assertRaises(NameError, ar_downsample.Id().reify)
     ar_downsample._loadAR()
     self.assertIsNotNone(ar_downsample.Id().reify())