Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
when path thenの記述を間違ったとき、TemplateSyntaxErrorを返すテストの追加
Browse files Browse the repository at this point in the history
  • Loading branch information
giginet committed Jun 29, 2014
1 parent 72d4517 commit 7b616ac
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/kawaz/core/templatetags/tests/test_utils.py
Expand Up @@ -5,7 +5,7 @@
__author__ = 'giginet'

from django.test import TestCase
from django.template import Template, Context
from django.template import Template, Context, TemplateSyntaxError
from unittest.mock import MagicMock


Expand All @@ -29,7 +29,7 @@ def test_when_regex_then(self):
render = t.render(c)
self.assertEqual(render, 'active')

def test_string_by_path_with_not_matched_pattern(self):
def test_when_regex_then_not_matched_pattern(self):
'''
when =~ <pattern> then <string>タグがpatternとマッチしないとき、空白文字を返す
'''
Expand All @@ -45,3 +45,12 @@ def test_string_by_path_with_not_matched_pattern(self):
})
render = t.render(c)
self.assertEqual(render, '')

def test_when_regex_then_invalid_argument(self):
'''
when path =~ <pattern> then <string>タグのシンタックスが間違ってたら、TemplateSyntaxErrorを返す
'''
t = ("""{% load utils %}"""
"""{% when =~ pattern then 'active' %}""")
self.assertRaises(TemplateSyntaxError, Template, t)

0 comments on commit 7b616ac

Please sign in to comment.