mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-12-19 00:09:21 +11:00
Code cleanup.
This commit is contained in:
parent
ebdd36cfeb
commit
d86f8b812b
4 changed files with 3 additions and 10 deletions
|
@ -11,8 +11,7 @@
|
|||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
#import sys
|
||||
import os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
|
|
|
@ -112,7 +112,7 @@ class NakedHtmlFormatter(HtmlFormatter):
|
|||
def pygmentize(code_string, lexer_name=LEXER_DEFAULT):
|
||||
try:
|
||||
lexer = lexer_name and get_lexer_by_name(lexer_name) \
|
||||
or PythonLexer()
|
||||
except Exception as e:
|
||||
or PythonLexer()
|
||||
except Exception:
|
||||
lexer = PythonLexer()
|
||||
return highlight(code_string, lexer, NakedHtmlFormatter())
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from datetime import datetime
|
||||
from os import urandom
|
||||
from random import SystemRandom
|
||||
|
||||
from django.db import models
|
||||
|
|
|
@ -5,8 +5,6 @@ from django.test.client import Client
|
|||
from django.test import TestCase
|
||||
|
||||
from ..models import Snippet
|
||||
from ..forms import EXPIRE_DEFAULT
|
||||
from ..highlight import LEXER_DEFAULT
|
||||
|
||||
class SnippetAPITestCase(TestCase):
|
||||
|
||||
|
@ -121,8 +119,6 @@ class SnippetAPITestCase(TestCase):
|
|||
}
|
||||
|
||||
response = self.client.post(self.api_url, data)
|
||||
content = response.content.decode('utf-8')
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(Snippet.objects.count(), 1)
|
||||
|
||||
|
@ -135,6 +131,5 @@ class SnippetAPITestCase(TestCase):
|
|||
'lexer': 'foobar'
|
||||
}
|
||||
response = self.client.post(self.api_url, data)
|
||||
content = response.content.decode('utf-8')
|
||||
self.assertEqual(response.status_code, 400)
|
||||
self.assertEqual(Snippet.objects.count(), 0)
|
||||
|
|
Loading…
Reference in a new issue