示例#1
0
        def exclude_status(annotations, default):
            exclude = util.value_to_bool(annotations.get('exclude', default))

            # include will always override value of exclude if both exist
            exclude = not util.value_to_bool(
                annotations.get('include', not exclude))

            return exclude
示例#2
0
 def test_value_to_bool(self):
     self.assertTrue(scalyr_util.value_to_bool(True))
     self.assertTrue(scalyr_util.value_to_bool(1))
     self.assertFalse(scalyr_util.value_to_bool(0))
     self.assertRaises(ValueError, scalyr_util.value_to_bool, 100)
     self.assertTrue(scalyr_util.value_to_bool("something"))
     self.assertFalse(scalyr_util.value_to_bool("f"))
     self.assertFalse(scalyr_util.value_to_bool("False"))
     self.assertFalse(scalyr_util.value_to_bool(""))