mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Fixed tests for Py3
This commit is contained in:
parent
f936bd43c3
commit
cf61cc52d4
3 changed files with 4 additions and 2 deletions
|
@ -145,4 +145,5 @@ def pygmentize(code_string, lexer_name=LEXER_DEFAULT):
|
||||||
or PythonLexer()
|
or PythonLexer()
|
||||||
except Exception:
|
except Exception:
|
||||||
lexer = PythonLexer()
|
lexer = PythonLexer()
|
||||||
|
|
||||||
return highlight(code_string, lexer, NakedHtmlFormatter())
|
return highlight(code_string, lexer, NakedHtmlFormatter())
|
||||||
|
|
|
@ -76,7 +76,7 @@ class SnippetTestCase(TestCase):
|
||||||
# The unicode method contains the snippet id so we can easily print
|
# The unicode method contains the snippet id so we can easily print
|
||||||
# the id using {{ snippet }}
|
# the id using {{ snippet }}
|
||||||
snippet = Snippet.objects.all()[0]
|
snippet = Snippet.objects.all()[0]
|
||||||
self.assertTrue(snippet.secret_id in snippet.__unicode__())
|
self.assertTrue(snippet.secret_id in snippet.__str__())
|
||||||
|
|
||||||
def test_new_snippet_custom_lexer(self):
|
def test_new_snippet_custom_lexer(self):
|
||||||
# You can pass a lexer key in GET.l
|
# You can pass a lexer key in GET.l
|
||||||
|
|
|
@ -12,6 +12,7 @@ from django.http import (Http404, HttpResponse, HttpResponseBadRequest,
|
||||||
HttpResponseRedirect)
|
HttpResponseRedirect)
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.utils.encoding import force_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.defaults import page_not_found as django_page_not_found, \
|
from django.views.defaults import page_not_found as django_page_not_found, \
|
||||||
|
@ -210,7 +211,7 @@ class SnippetDiffView(TemplateView):
|
||||||
diff.content = '\n'.join(d).strip()
|
diff.content = '\n'.join(d).strip()
|
||||||
diff.lexer = 'diff'
|
diff.lexer = 'diff'
|
||||||
else:
|
else:
|
||||||
diff.content = _(u'No changes were made between this two files.')
|
diff.content = force_text(_(u'No changes were made between this two files.'))
|
||||||
diff.lexer = 'text'
|
diff.lexer = 'text'
|
||||||
|
|
||||||
return diff
|
return diff
|
||||||
|
|
Loading…
Reference in a new issue