Remove handling of 'u' prefix
... because the prefix is no longer printed in Python 3. In python 2 >>> print({u'foo': u'baa'}) {u'foo': u'baa'} >>> print([u'foo', 'baa']) [u'foo', 'baa'] In python 3 >>> print({u'foo': u'baa'}) {'foo': 'baa'} >>> print([u'foo', 'baa']) ['foo', 'baa'] Change-Id: I8f4adab5d7c6c8730d08f9311c55783ea719527f
This commit is contained in:
parent
a6ec6cc784
commit
869e396eb5
@ -114,7 +114,7 @@ Puppet::Type.type(:cinder_type).provide(
|
||||
end
|
||||
|
||||
def self.pythondict2array(input)
|
||||
json_input = JSON.parse(input.gsub(/u'([^']*)'/, '"\1"').gsub(/'/, '"'))
|
||||
json_input = JSON.parse(input.gsub(/'/, '"'))
|
||||
output = []
|
||||
json_input.each do | k, v |
|
||||
output = output + ["#{k}=#{v}"]
|
||||
|
@ -122,7 +122,7 @@ access_project_ids="54f4d231201b4944a5fa4587a09bda23, 54f4d231201b4944a5fa4587a0
|
||||
|
||||
describe '#pythondict2array' do
|
||||
it 'should return an array with key-value when provided with a unicode python dict' do
|
||||
s = "{u'key': 'value', u'key2': 'value2'}"
|
||||
s = "{'key': 'value', 'key2': 'value2'}"
|
||||
expect(provider_class.pythondict2array(s)).to eq(['key=value', 'key2=value2'])
|
||||
end
|
||||
|
||||
@ -139,7 +139,7 @@ access_project_ids="54f4d231201b4944a5fa4587a09bda23, 54f4d231201b4944a5fa4587a0
|
||||
end
|
||||
|
||||
it 'should call pythondict2array when provided with a hash' do
|
||||
s = "{u'key': 'value', u'key2': 'value2'}"
|
||||
s = "{'key': 'value', 'key2': 'value2'}"
|
||||
expect(provider_class.parsestring(s)).to eq(['key=value', 'key2=value2'])
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user