def test_strip_units_multi_arg(self):
        outs = strip_units(self.unit_array, self.unit_scalar)
        self.assertEquals(len(outs), 2)
        for x in outs:
            self.assertFalse(isinstance(x, (UnitArray, UnitScalar)))

        outs = strip_units(self.plain_array, self.plain_scalar)
        self.assertEquals(len(outs), 2)
        for x in outs:
            self.assertFalse(isinstance(x, (UnitArray, UnitScalar)))

        outs = strip_units(self.unit_array, self.unit_scalar, self.plain_array,
                           self.plain_scalar)
        self.assertEquals(len(outs), 4)
        for x in outs:
            self.assertFalse(isinstance(x, (UnitArray, UnitScalar)))
Esempio n. 2
0
    def test_strip_units_multi_arg(self):
        outs = strip_units(self.unit_array, self.unit_scalar)
        self.assertEqual(len(outs), 2)
        for x in outs:
            self.assertFalse(isinstance(x, (UnitArray, UnitScalar)))

        outs = strip_units(self.plain_array, self.plain_scalar)
        self.assertEqual(len(outs), 2)
        for x in outs:
            self.assertFalse(isinstance(x, (UnitArray, UnitScalar)))

        outs = strip_units(self.unit_array, self.unit_scalar, self.plain_array,
                           self.plain_scalar)
        self.assertEqual(len(outs), 4)
        for x in outs:
            self.assertFalse(isinstance(x, (UnitArray, UnitScalar)))
    def test_strip_units_one_arg(self):
        self.assertFalse(isinstance(strip_units(self.unit_array),
                                    (UnitArray, UnitScalar)))
        self.assertFalse(isinstance(strip_units(self.unit_scalar),
                                    (UnitArray, UnitScalar)))
        self.assertFalse(isinstance(strip_units(self.plain_array),
                                    (UnitArray, UnitScalar)))
        self.assertFalse(isinstance(strip_units(self.plain_scalar),
                                    (UnitArray, UnitScalar)))

        # Check for stupidity when returning only one argument.
        self.assertFalse(isinstance(strip_units(self.unit_scalar), tuple))
        self.assertFalse(isinstance(strip_units(self.plain_scalar), tuple))
    def test_strip_units_one_arg(self):
        self.assertFalse(
            isinstance(strip_units(self.unit_array), (UnitArray, UnitScalar)))
        self.assertFalse(
            isinstance(strip_units(self.unit_scalar), (UnitArray, UnitScalar)))
        self.assertFalse(
            isinstance(strip_units(self.plain_array), (UnitArray, UnitScalar)))
        self.assertFalse(
            isinstance(strip_units(self.plain_scalar),
                       (UnitArray, UnitScalar)))

        # Check for stupidity when returning only one argument.
        self.assertFalse(isinstance(strip_units(self.unit_scalar), tuple))
        self.assertFalse(isinstance(strip_units(self.plain_scalar), tuple))