owchie to_native
This commit is contained in:
1 parent
49fb0f87d5
commit
b01e1c269d
3 files changed
+6
-5
No files matched your search
@@ -1179,9 +1179,10 @@ class GlobalHeaderTransform(tornado.web.OutputTransform):
|
||||
if removed_headers is None:
|
||||
removed_headers = []
|
||||
|
||||
return type(name, (GlobalHeaderTransform,), dict(HEADERS=headers,
|
||||
FORCED_HEADERS=forced_headers,
|
||||
REMOVED_HEADERS=removed_headers))
|
||||
return type(octoprint.util.to_native_str(name), (GlobalHeaderTransform,),
|
||||
dict(HEADERS=headers,
|
||||
FORCED_HEADERS=forced_headers,
|
||||
REMOVED_HEADERS=removed_headers))
|
||||
|
||||
def __init__(self, request):
|
||||
tornado.web.OutputTransform.__init__(self, request)
|
||||
|
||||
@@ -517,7 +517,6 @@ def to_bytes(s_or_u, encoding="utf-8", errors="strict"):
|
||||
|
||||
to_str = deprecated("to_str has been renamed to to_bytes", since="1.4.0")(to_bytes)
|
||||
|
||||
return to_bytes(s_or_u, encoding=encoding, errors=errors)
|
||||
|
||||
def to_unicode(s_or_u, encoding="utf-8", errors="strict"):
|
||||
"""Make sure ``s_or_u`` is a unicode string."""
|
||||
|
||||
@@ -7,6 +7,7 @@ import ddt
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.plugin.core
|
||||
from octoprint.util import to_native_str
|
||||
|
||||
##~~ Helpers for testing mixin type extraction
|
||||
|
||||
@@ -337,7 +338,7 @@ class PluginTestCase(unittest.TestCase):
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_mixins_matching_bases(self, bases_to_set, bases_to_check, expected):
|
||||
Foo = type("Foo", bases_to_set, dict())
|
||||
Foo = type(to_native_str("Foo"), bases_to_set, dict())
|
||||
actual = octoprint.plugin.core.PluginManager.mixins_matching_bases(Foo, *bases_to_check)
|
||||
self.assertSetEqual(actual, set(expected))
|
||||
|
||||
Reference in new issue
Block a user