示例#1
0
 def test_known_bound_method_as_part_of_class(self):
     class OtherObject(object):
         def a_method(self):
             pass
     class_name_and_loc = locations.get_name_and_loc(OtherObject().a_method)
     self.assertIn('OtherObject.a_method', class_name_and_loc)
     self.assertIn('locations_test.py', class_name_and_loc)
示例#2
0
    def test_known(self):
        class OtherObject(object):
            pass

        class_name_and_loc = locations.get_name_and_loc(OtherObject)
        self.assertIn('OtherObject', class_name_and_loc)
        self.assertIn('locations_test.py', class_name_and_loc)
示例#3
0
    def test_known_as_part_of_class(self):
        class OtherObject(object):
            def a_method(self):
                pass

        class_name_and_loc = locations.get_name_and_loc(OtherObject.a_method)
        self.assertIn('OtherObject.a_method', class_name_and_loc)
        self.assertIn('locations_test.py', class_name_and_loc)
示例#4
0
 def test_unknown(self):
     unknown_class = type('UnknownClass', (object,), {})
     class_name_and_loc = locations.get_name_and_loc(unknown_class)
     self.assertEqual('tests.locations_test.UnknownClass', class_name_and_loc)
示例#5
0
 def test_known_external_bound_method_as_part_of_class(self):
     class_name_and_loc = locations.get_name_and_loc(ExternalObject().a_method)
     self.assertIn('ExternalObject.a_method', class_name_and_loc)
     self.assertIn('locations_test.py', class_name_and_loc)
示例#6
0
 def test_known_external(self):
     class_name_and_loc = locations.get_name_and_loc(ExternalObject)
     self.assertIn('ExternalObject', class_name_and_loc)
     self.assertIn('locations_test.py', class_name_and_loc)
示例#7
0
 def test_known(self):
     class OtherObject(object):
         pass
     class_name_and_loc = locations.get_name_and_loc(OtherObject)
     self.assertIn('OtherObject', class_name_and_loc)
     self.assertIn('locations_test.py', class_name_and_loc)
示例#8
0
 def test_unknown(self):
     unknown_class = type('UnknownClass', (object, ), {})
     class_name_and_loc = locations.get_name_and_loc(unknown_class)
     self.assertEqual('tests.locations_test.UnknownClass',
                      class_name_and_loc)
示例#9
0
 def test_known_external_bound_method_as_part_of_class(self):
     class_name_and_loc = locations.get_name_and_loc(
         ExternalObject().a_method)
     self.assertIn('ExternalObject.a_method', class_name_and_loc)
     self.assertIn('locations_test.py', class_name_and_loc)
示例#10
0
 def test_known_external(self):
     class_name_and_loc = locations.get_name_and_loc(ExternalObject)
     self.assertIn('ExternalObject', class_name_and_loc)
     self.assertIn('locations_test.py', class_name_and_loc)
示例#11
0
 def test_unknown(self):
     self.assertEqual('unittest.case.TestCase',
                      locations.get_name_and_loc(unittest.TestCase))
示例#12
0
 def test_unknown(self):
     self.assertEqual('unittest.case.TestCase',
                      locations.get_name_and_loc(unittest.TestCase))