예제 #1
0
    def test_exception_too_large_value_init(self):
        """Test expected exception from initialization.

        """
        message = "A `value` of ``1.1`` did not raise an exception."

        with self.assertRaises(ValueError, msg=message):
            pyseawater.MassFraction(1.1)
예제 #2
0
    def test_value_init(self):
        """Test property `value` after initialization.

        """
        fraction = pyseawater.MassFraction(0.5)

        self.assertEqual(fraction.value, 0.5,
                         "The property `value` is not equal to ``0.5``.")
예제 #3
0
    def test_value_setter(self):
        """Test `value` setter.

        """
        fraction = pyseawater.MassFraction(1.)
        fraction.value = 0.5

        self.assertEqual(fraction.value, 0.5,
                         "The property `value` is not equal to ``0.5``.")
예제 #4
0
    def test_exception_too_large_value_setter(self):
        """Test expected exception from `value` setter.

        """
        fraction = pyseawater.MassFraction(1.)

        message = "A `value` of ``1.1`` did not raise an exception."

        with self.assertRaises(ValueError, msg=message):
            fraction.value = 1.1