def test_str_option(self): # normal behavior option = StrOption("test-name", "bar", "Test Description") option.set("foo") self.assertEqual(option.value, "foo") # conversion to str option.set(123) self.assertEqual(option.value, "123") # conversion to str option.set(-123) self.assertEqual(option.value, "-123")
def test_str_option(self): # normal behavior option = StrOption(u"tëst-name", u"föo", u"Tëst Description") self.assertEqual(option.name, u"tëst-name") self.assertEqual(option.description, u"Tëst Description") self.assertEqual(option.value, u"föo") # re-set value option.set(u"bår") self.assertEqual(option.value, u"bår") # conversion to str option.set(123) self.assertEqual(option.value, "123") # conversion to str option.set(-123) self.assertEqual(option.value, "-123") # None value option.set(None) self.assertEqual(option.value, None)