Commit eb9e7e5d by Timothée Peignier

use assertEqual

parent c75d5682
...@@ -26,18 +26,18 @@ class CompilerTest(TestCase): ...@@ -26,18 +26,18 @@ class CompilerTest(TestCase):
def test_output_path(self): def test_output_path(self):
output_path = self.compiler.output_path("js/helpers.coffee", "js") output_path = self.compiler.output_path("js/helpers.coffee", "js")
self.assertEquals(output_path, "js/helpers.js") self.assertEqual(output_path, "js/helpers.js")
def test_compilers_class(self): def test_compilers_class(self):
compilers_class = self.compiler.compilers compilers_class = self.compiler.compilers
self.assertEquals(compilers_class[0], DummyCompiler) self.assertEqual(compilers_class[0], DummyCompiler)
def test_compile(self): def test_compile(self):
paths = self.compiler.compile([ paths = self.compiler.compile([
_('pipeline/js/dummy.coffee'), _('pipeline/js/dummy.coffee'),
_('pipeline/js/application.js'), _('pipeline/js/application.js'),
]) ])
self.assertEquals([_('pipeline/js/dummy.js'), _('pipeline/js/application.js')], paths) self.assertEqual([_('pipeline/js/dummy.js'), _('pipeline/js/application.js')], paths)
def tearDown(self): def tearDown(self):
settings.PIPELINE_COMPILERS = self.old_compilers settings.PIPELINE_COMPILERS = self.old_compilers
...@@ -22,24 +22,24 @@ class CompressorTest(TestCase): ...@@ -22,24 +22,24 @@ class CompressorTest(TestCase):
self.compressor = Compressor() self.compressor = Compressor()
def test_js_compressor_class(self): def test_js_compressor_class(self):
self.assertEquals(self.compressor.js_compressor, YuglifyCompressor) self.assertEqual(self.compressor.js_compressor, YuglifyCompressor)
def test_css_compressor_class(self): def test_css_compressor_class(self):
self.assertEquals(self.compressor.css_compressor, YuglifyCompressor) self.assertEqual(self.compressor.css_compressor, YuglifyCompressor)
def test_concatenate_and_rewrite(self): def test_concatenate_and_rewrite(self):
css = self.compressor.concatenate_and_rewrite([ css = self.compressor.concatenate_and_rewrite([
_('pipeline/css/first.css'), _('pipeline/css/first.css'),
_('pipeline/css/second.css') _('pipeline/css/second.css')
], 'css/screen.css') ], 'css/screen.css')
self.assertEquals(""".concat {\n display: none;\n}\n\n.concatenate {\n display: block;\n}\n""", css) self.assertEqual(""".concat {\n display: none;\n}\n\n.concatenate {\n display: block;\n}\n""", css)
def test_concatenate(self): def test_concatenate(self):
js = self.compressor.concatenate([ js = self.compressor.concatenate([
_('pipeline/js/first.js'), _('pipeline/js/first.js'),
_('pipeline/js/second.js') _('pipeline/js/second.js')
]) ])
self.assertEquals("""function concat() {\n console.log(arguments);\n}\n\nfunction cat() {\n console.log("hello world");\n}\n""", js) self.assertEqual("""function concat() {\n console.log(arguments);\n}\n\nfunction cat() {\n console.log("hello world");\n}\n""", js)
@patch.object(base64, 'b64encode') @patch.object(base64, 'b64encode')
def test_encoded_content(self, mock): def test_encoded_content(self, mock):
...@@ -51,35 +51,35 @@ class CompressorTest(TestCase): ...@@ -51,35 +51,35 @@ class CompressorTest(TestCase):
def test_relative_path(self): def test_relative_path(self):
relative_path = self.compressor.relative_path("images/sprite.png", 'css/screen.css') relative_path = self.compressor.relative_path("images/sprite.png", 'css/screen.css')
self.assertEquals(relative_path, '../images/sprite.png') self.assertEqual(relative_path, '../images/sprite.png')
def test_base_path(self): def test_base_path(self):
base_path = self.compressor.base_path([ base_path = self.compressor.base_path([
_('js/templates/form.jst'), _('js/templates/field.jst') _('js/templates/form.jst'), _('js/templates/field.jst')
]) ])
self.assertEquals(base_path, _('js/templates')) self.assertEqual(base_path, _('js/templates'))
def test_absolute_path(self): def test_absolute_path(self):
absolute_path = self.compressor.absolute_path('../../images/sprite.png', absolute_path = self.compressor.absolute_path('../../images/sprite.png',
'css/plugins/') 'css/plugins/')
self.assertEquals(absolute_path, 'images/sprite.png') self.assertEqual(absolute_path, 'images/sprite.png')
absolute_path = self.compressor.absolute_path('/images/sprite.png', absolute_path = self.compressor.absolute_path('/images/sprite.png',
'css/plugins/') 'css/plugins/')
self.assertEquals(absolute_path, '/images/sprite.png') self.assertEqual(absolute_path, '/images/sprite.png')
def test_template_name(self): def test_template_name(self):
name = self.compressor.template_name('templates/photo/detail.jst', name = self.compressor.template_name('templates/photo/detail.jst',
'templates/') 'templates/')
self.assertEquals(name, 'photo_detail') self.assertEqual(name, 'photo_detail')
name = self.compressor.template_name('templates/photo_edit.jst', '') name = self.compressor.template_name('templates/photo_edit.jst', '')
self.assertEquals(name, 'photo_edit') self.assertEqual(name, 'photo_edit')
name = self.compressor.template_name('templates\photo\detail.jst', name = self.compressor.template_name('templates\photo\detail.jst',
'templates\\') 'templates\\')
self.assertEquals(name, 'photo_detail') self.assertEqual(name, 'photo_detail')
def test_compile_templates(self): def test_compile_templates(self):
templates = self.compressor.compile_templates([_('pipeline/templates/photo/list.jst')]) templates = self.compressor.compile_templates([_('pipeline/templates/photo/list.jst')])
self.assertEquals(templates, """window.JST = window.JST || {};\n%s\nwindow.JST[\'list\'] = template(\'<div class="photo">\\n <img src="<%%= src %%>" />\\n <div class="caption">\\n <%%= caption %%>\\n </div>\\n</div>\');\n""" % TEMPLATE_FUNC) self.assertEqual(templates, """window.JST = window.JST || {};\n%s\nwindow.JST[\'list\'] = template(\'<div class="photo">\\n <img src="<%%= src %%>" />\\n <div class="caption">\\n <%%= caption %%>\\n </div>\\n</div>\');\n""" % TEMPLATE_FUNC)
templates = self.compressor.compile_templates([ templates = self.compressor.compile_templates([
_('pipeline/templates/video/detail.jst'), _('pipeline/templates/video/detail.jst'),
_('pipeline/templates/photo/detail.jst') _('pipeline/templates/photo/detail.jst')
...@@ -95,16 +95,16 @@ class CompressorTest(TestCase): ...@@ -95,16 +95,16 @@ class CompressorTest(TestCase):
def test_construct_asset_path(self): def test_construct_asset_path(self):
asset_path = self.compressor.construct_asset_path("../../images/sprite.png", asset_path = self.compressor.construct_asset_path("../../images/sprite.png",
"css/plugins/gallery.css", "css/gallery.css") "css/plugins/gallery.css", "css/gallery.css")
self.assertEquals(asset_path, "../images/sprite.png") self.assertEqual(asset_path, "../images/sprite.png")
asset_path = self.compressor.construct_asset_path("/images/sprite.png", asset_path = self.compressor.construct_asset_path("/images/sprite.png",
"css/plugins/gallery.css", "css/gallery.css") "css/plugins/gallery.css", "css/gallery.css")
self.assertEquals(asset_path, "/images/sprite.png") self.assertEqual(asset_path, "/images/sprite.png")
def test_url_rewrite(self): def test_url_rewrite(self):
output = self.compressor.concatenate_and_rewrite([ output = self.compressor.concatenate_and_rewrite([
_('pipeline/css/urls.css'), _('pipeline/css/urls.css'),
], 'css/screen.css') ], 'css/screen.css')
self.assertEquals("""@font-face { self.assertEqual("""@font-face {
font-family: 'Pipeline'; font-family: 'Pipeline';
src: url(../pipeline/fonts/pipeline.eot); src: url(../pipeline/fonts/pipeline.eot);
src: url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype'); src: url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment