Translate print statement to print function
Use "from __future__ import print_function" docs.python.org/3/howto/pyporting.html#from-future-import-print-function Partial Implement: blueprint py33-support Change-Id: I92fc07257851795a9972c8273d3278c8679d6628
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
@@ -59,7 +60,7 @@ def print_list(objs, fields, field_labels, formatters={}, sortby=0):
|
||||
data = getattr(o, field, '')
|
||||
row.append(data)
|
||||
pt.add_row(row)
|
||||
print pt.get_string(sortby=field_labels[sortby])
|
||||
print(pt.get_string(sortby=field_labels[sortby]))
|
||||
|
||||
|
||||
def print_dict(d, dict_property="Property", wrap=0):
|
||||
@@ -84,7 +85,7 @@ def print_dict(d, dict_property="Property", wrap=0):
|
||||
if wrap > 0:
|
||||
v = textwrap.fill(str(v), wrap)
|
||||
pt.add_row([k, v])
|
||||
print pt.get_string()
|
||||
print(pt.get_string())
|
||||
|
||||
|
||||
def find_resource(manager, name_or_id):
|
||||
@@ -171,5 +172,5 @@ def merge_nested_dict(dest, source, depth=0):
|
||||
|
||||
def exit(msg=''):
|
||||
if msg:
|
||||
print >> sys.stderr, msg
|
||||
print(msg, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
from ceilometerclient.tests import utils
|
||||
|
||||
from ceilometerclient.common import http
|
||||
|
||||
|
||||
fixtures = {}
|
||||
|
||||
|
||||
@@ -26,23 +26,23 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
def test_url_generation_trailing_slash_in_base(self):
|
||||
client = http.HTTPClient('http://localhost/')
|
||||
url = client._make_connection_url('/v1/resources')
|
||||
print client.connection_params
|
||||
print(client.connection_params)
|
||||
self.assertEqual(url, '/v1/resources')
|
||||
|
||||
def test_url_generation_without_trailing_slash_in_base(self):
|
||||
client = http.HTTPClient('http://localhost')
|
||||
url = client._make_connection_url('/v1/resources')
|
||||
print client.connection_params
|
||||
print(client.connection_params)
|
||||
self.assertEqual(url, '/v1/resources')
|
||||
|
||||
def test_url_generation_prefix_slash_in_path(self):
|
||||
client = http.HTTPClient('http://localhost/')
|
||||
url = client._make_connection_url('/v1/resources')
|
||||
print client.connection_params
|
||||
print(client.connection_params)
|
||||
self.assertEqual(url, '/v1/resources')
|
||||
|
||||
def test_url_generation_without_prefix_slash_in_path(self):
|
||||
client = http.HTTPClient('http://localhost')
|
||||
url = client._make_connection_url('v1/resources')
|
||||
print client.connection_params
|
||||
print(client.connection_params)
|
||||
self.assertEqual(url, '/v1/resources')
|
||||
|
||||
Reference in New Issue
Block a user