code: def test_convert_to_bool(self):
      # Verify that TypeError occurs when bad things are returned
      # from __bool__().  This isn't really a bool test, but
      # it's related.
      check = lambda o: self.assertRaises(TypeError, bool, o)
  
      class Foo(object):
          def __bool__(self):
              return self
  
      check(Foo())
  
      class Bar(object):
          def __bool__(self):
              return "Yes"
  
      check(Bar())
  
      class Baz(int):
          def __bool__(self):
              return self
  
      check(Baz())
  
      # __bool__() must return a bool not an int
      class Spam(int):
          def __bool__(self):
              return 1
  
      check(Spam())
  
      class Eggs:
          def __len__(self):
              return -1
  
      self.assertRaises(ValueError, bool, Eggs())
  
imports: import unittest
  from test.support import os_helper
  import os
label_desc: Use image node_id 24 for calling the BoolTest obj's underlying member method code with example usage: obj.test_convert_to_bool() and returns: self, str, self, int, unknown