(self, result, obj, methodname, *args, **kwargs)
| 52 | |
| 53 | # check that obj.method(*args) returns result |
| 54 | def checkequal(self, result, obj, methodname, *args, **kwargs): |
| 55 | result = self.fixtype(result) |
| 56 | obj = self.fixtype(obj) |
| 57 | args = self.fixtype(args) |
| 58 | kwargs = {k: self.fixtype(v) for k,v in kwargs.items()} |
| 59 | realresult = getattr(obj, methodname)(*args, **kwargs) |
| 60 | self.assertEqual( |
| 61 | result, |
| 62 | realresult |
| 63 | ) |
| 64 | # if the original is returned make sure that |
| 65 | # this doesn't happen with subclasses |
| 66 | if obj is realresult: |
| 67 | try: |
| 68 | class subtype(self.__class__.type2test): |
| 69 | pass |
| 70 | except TypeError: |
| 71 | pass # Skip this if we can't subclass |
| 72 | else: |
| 73 | obj = subtype(obj) |
| 74 | realresult = getattr(obj, methodname)(*args) |
| 75 | self.assertIsNot(obj, realresult) |
| 76 | |
| 77 | # check that obj.method(*args) raises exc |
| 78 | def checkraises(self, exc, obj, methodname, *args, expected_msg=None): |
no test coverage detected