Ejemplo n.º 1
0
    def test_normalisation_with_single_existent_channel_with_order_as_float(self):
        # This will just raise a warning:
        self.assertTrue(v._validate_normalisation(
            {"normalise": {"k": {"order": 3.14}}}, ["k", "yep"]))

        # These are no good:
        self.assertRaises(TypeError, v._validate_normalisation,
            *[{"normalise": {"k": {"order": None}}}, ["k", "yep"]])
        self.assertRaises(TypeError, v._validate_normalisation,
            *[{"normalise": {"k": {"order": True}}}, ["k", "yep"]])
        self.assertRaises(TypeError, v._validate_normalisation,
            *[{"normalise": {"k": {"order": []}}}, ["k", "yep"]])
        self.assertRaises(TypeError, v._validate_normalisation,
            *[{"normalise": {"k": {"order": {}}}}, ["k", "yep"]])
        self.assertRaises(TypeError, v._validate_normalisation,
            *[{"normalise": {"k": {"order": ()}}}, ["k", "yep"]])

        # And positive
        self.assertRaises(ValueError, v._validate_normalisation,
            *[{"normalise": {"k": {"order": -1}}}, ["k", "yep"]])
Ejemplo n.º 2
0
 def test_normalisation_with_single_existent_channel_with_order_as_int(self):
     # Like the order, which must be an integer-like
     self.assertTrue(v._validate_normalisation(
         {"normalise": {"k": {"order": 0}}}, ["k", "yep"]))
Ejemplo n.º 3
0
 def test_normalisation_as_false(self):
     self.assertTrue(v._validate_normalisation({"normalise": False}, []))
Ejemplo n.º 4
0
 def test_normalisation_with_non_existent_channel(self):
     self.assertTrue(v._validate_normalisation(
         {"normalise": {"what": True}}, ["k", "yep"]))
Ejemplo n.º 5
0
 def test_normalisation_no_configuration_provided(self):
     self.assertTrue(v._validate_normalisation({}, []))