Beispiel #1
0
 def test_convert_to_boolean_str(self):
     self.assertIs(attributes.convert_to_boolean('True'), True)
     self.assertIs(attributes.convert_to_boolean('true'), True)
     self.assertIs(attributes.convert_to_boolean('False'), False)
     self.assertIs(attributes.convert_to_boolean('false'), False)
     self.assertIs(attributes.convert_to_boolean('0'), False)
     self.assertIs(attributes.convert_to_boolean('1'), True)
     self.assertRaises(n_exc.InvalidInput, attributes.convert_to_boolean,
                       '7')
 def test_convert_to_boolean_str(self):
     self.assertIs(attributes.convert_to_boolean('True'), True)
     self.assertIs(attributes.convert_to_boolean('true'), True)
     self.assertIs(attributes.convert_to_boolean('False'), False)
     self.assertIs(attributes.convert_to_boolean('false'), False)
     self.assertIs(attributes.convert_to_boolean('0'), False)
     self.assertIs(attributes.convert_to_boolean('1'), True)
     self.assertRaises(n_exc.InvalidInput,
                       attributes.convert_to_boolean,
                       '7')
Beispiel #3
0
 def test_convert_to_boolean_str(self):
     self.assertTrue(attributes.convert_to_boolean('True'))
     self.assertTrue(attributes.convert_to_boolean('true'))
     self.assertFalse(attributes.convert_to_boolean('False'))
     self.assertFalse(attributes.convert_to_boolean('false'))
     self.assertFalse(attributes.convert_to_boolean('0'))
     self.assertTrue(attributes.convert_to_boolean('1'))
     self.assertRaises(n_exc.InvalidInput, attributes.convert_to_boolean,
                       '7')
     self.assertRaises(n_exc.InvalidInput, attributes.convert_to_boolean,
                       "")
     self.assertRaises(n_exc.InvalidInput, attributes.convert_to_boolean,
                       "abc")
     self.assertRaises(n_exc.InvalidInput, attributes.convert_to_boolean,
                       123)
Beispiel #4
0
 def test_convert_to_boolean_int(self):
     self.assertIs(attributes.convert_to_boolean(0), False)
     self.assertIs(attributes.convert_to_boolean(1), True)
     self.assertRaises(n_exc.InvalidInput, attributes.convert_to_boolean, 7)
Beispiel #5
0
 def test_convert_to_boolean_bool(self):
     self.assertIs(attributes.convert_to_boolean(True), True)
     self.assertIs(attributes.convert_to_boolean(False), False)
Beispiel #6
0
 def test_convert_to_boolean_bool(self):
     self.assertTrue(attributes.convert_to_boolean(True))
     self.assertFalse(attributes.convert_to_boolean(False))
 def test_convert_to_boolean_int(self):
     self.assertIs(attributes.convert_to_boolean(0), False)
     self.assertIs(attributes.convert_to_boolean(1), True)
     self.assertRaises(n_exc.InvalidInput,
                       attributes.convert_to_boolean,
                       7)
 def test_convert_to_boolean_bool(self):
     self.assertIs(attributes.convert_to_boolean(True), True)
     self.assertIs(attributes.convert_to_boolean(False), False)