1. fanstatic
  2. Untitled project
  3. fanstatic

Commits

Jan-Jaap Driessen  committed b664423

fix on python3

  • Participants
  • Parent commits 257c497
  • Branches pluggable-injector

Comments (0)

Files changed (1)

File tests/test_injectorplugin.py

View file
 from fanstatic.injector import InjectorPlugin
 from fanstatic.registry import InjectorRegistry
 from fanstatic import make_injector
+from fanstatic import compat
 from fanstatic import ConfigurationError
 from fanstatic.injector import TopBottomInjector
 
 
     def __call__(self, html, needed):
         needed_html = self.make_inclusion(needed).render()
-        return html.replace('<head>', '<head>%s' % needed_html, 1)
-
+        return html.replace(
+            compat.as_bytestring('<head>'),
+            compat.as_bytestring('<head>%s' % needed_html), 1)
 
 def test_injector_based_on_injectorplugin():
     foo = Library('foo', '')
     html = b'<html><head></head><body></body></html>'
 
     assert inj(html, needed) == \
-        '''<html><head><link rel="stylesheet" type="text/css" href="/fanstatic/foo/a.css" />
-<link rel="stylesheet" type="text/css" href="/fanstatic/foo/b.css" /></head><body></body></html>'''
+        compat.as_bytestring('''<html><head><link rel="stylesheet" type="text/css" href="/fanstatic/foo/a.css" />
+<link rel="stylesheet" type="text/css" href="/fanstatic/foo/b.css" /></head><body></body></html>''')
 
 
 class TestingRegistry(object):