From c3525c0213c55bb8c86f7fc1e44dafc7756fa64a Mon Sep 17 00:00:00 2001 From: Igor Sobreira Date: Tue, 2 Apr 2013 05:25:06 +0000 Subject: [PATCH] add missing return to Py3kObject --- httpretty/__init__.py | 2 +- tests/unit/test_httpretty.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/httpretty/__init__.py b/httpretty/__init__.py index ef3ed46..cad7a03 100644 --- a/httpretty/__init__.py +++ b/httpretty/__init__.py @@ -61,7 +61,7 @@ class Py3kObject(object): if PY3: return ret else: - ret.encode('utf-8') + return ret.encode('utf-8') from datetime import datetime from datetime import timedelta diff --git a/tests/unit/test_httpretty.py b/tests/unit/test_httpretty.py index 49d3877..b3b9637 100644 --- a/tests/unit/test_httpretty.py +++ b/tests/unit/test_httpretty.py @@ -27,7 +27,7 @@ from __future__ import unicode_literals from sure import expect -from httpretty import HTTPretty, HTTPrettyError, STATUSES, URIInfo +from httpretty import HTTPretty, HTTPrettyError, STATUSES, URIInfo, Py3kObject def test_httpretty_should_raise_proper_exception_on_inconsistent_length(): @@ -160,3 +160,12 @@ def test_global_boolean_enabled(): expect(HTTPretty.is_enabled()).to.be.truthy HTTPretty.disable() expect(HTTPretty.is_enabled()).to.be.falsy + + +def test_py3kobject_implements_valid__repr__based_on__str__(): + class MyObject(Py3kObject): + def __str__(self): + return 'hi' + + myobj = MyObject() + expect(repr(myobj)).to.be.equal('hi')