Пример #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"]])
Пример #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"]))
Пример #3
0
 def test_normalisation_as_false(self):
     self.assertTrue(v._validate_normalisation({"normalise": False}, []))
Пример #4
0
 def test_normalisation_with_non_existent_channel(self):
     self.assertTrue(v._validate_normalisation(
         {"normalise": {"what": True}}, ["k", "yep"]))
Пример #5
0
 def test_normalisation_no_configuration_provided(self):
     self.assertTrue(v._validate_normalisation({}, []))