Esempio n. 1
0
    def test_spinint(self):
        """SpinInt can convert integers to and from strings."""

        spinint = base.SpinInt()
        val = 42
        string = spinint.to_string(val)
        self.assertIdentical(type(string), str)
        self.assertEqual(spinint.from_string(string), val)
Esempio n. 2
0
class Config2(Config1):

    parameters = {
        "int": base.Integer(42),
        "spinint": base.SpinInt(32, 1, 128),
    }
Esempio n. 3
0
    def test_spinint_not_in_range(self):
        """Values should be in range."""

        spinint = base.SpinInt(2, 1, 3)
        self.assertRaises(ValueError, spinint.to_string, 0)
        self.assertRaises(ValueError, spinint.from_string, "4")