Example #1
0
 def string_display(self):
     "__str__ and friends"
     config = Config({'foo': 'bar'})
     eq_(str(config), "<Config: {'foo': 'bar'}>")
     if six.PY2:
         eq_(unicode(config), six.u("<Config: {'foo': 'bar'}>"))  # noqa
     eq_(repr(config), "<Config: {'foo': 'bar'}>")
Example #2
0
 def string_display(self):
     "__str__ and friends"
     config = Config({'foo': 'bar'})
     eq_(str(config), "{'foo': 'bar'}")
     if six.PY2:
         eq_(unicode(config), six.u("{'foo': 'bar'}"))
     eq_(repr(config), "{'foo': 'bar'}")
Example #3
0
 def unicode_replaced_with_env_value(self):
     # Python 3 doesn't allow you to put 'bytes' objects into
     # os.environ, so the test makes no sense there.
     if six.PY3:
         return
     os.environ['FOO'] = 'myunicode'
     c = Config(defaults={'foo': six.u('myoldvalue')})
     c.load_shell_env()
     eq_(c.foo, 'myunicode')
     ok_(isinstance(c.foo, str))
Example #4
0
 def unicode_replaced_with_env_value(self):
     # Python 3 doesn't allow you to put 'bytes' objects into
     # os.environ, so the test makes no sense there.
     if six.PY3:
         return
     os.environ['FOO'] = 'myunicode'
     c = Config(defaults={'foo': six.u('myoldvalue')})
     c.load_shell_env()
     eq_(c.foo, 'myunicode')
     ok_(isinstance(c.foo, str))
Example #5
0
 def strings_replaced_with_env_value(self):
     os.environ['FOO'] = six.u('myvalue')
     c = Config(defaults={'foo': 'myoldvalue'})
     c.load_shell_env()
     eq_(c.foo, six.u('myvalue'))
     ok_(isinstance(c.foo, six.text_type))
Example #6
0
 def strings_replaced_with_env_value(self):
     os.environ['FOO'] = six.u('myvalue')
     c = Config(defaults={'foo': 'myoldvalue'})
     c.load_shell_env()
     eq_(c.foo, six.u('myvalue'))
     ok_(isinstance(c.foo, six.text_type))