

def test_filter_parsing(self):
    c = {
        'article': {
            'section': 'News',
        },
    }
    p = Parser('')

    def fe_test(s, val):
        self.assertEqual(FilterExpression(s, p).resolve(c), val)
    fe_test('article.section', 'News')
    fe_test('article.section|upper', 'NEWS')
    fe_test('"News"', 'News')
    fe_test("'News'", 'News')
    fe_test('"Some \\"Good\\" News"', 'Some "Good" News')
    fe_test('"Some \\"Good\\" News"', 'Some "Good" News')
    fe_test("'Some \\'Bad\\' News'", "Some 'Bad' News")
    fe = FilterExpression('"Some \\"Good\\" News"', p)
    self.assertEqual(fe.filters, [])
    self.assertEqual(fe.var, 'Some "Good" News')
    self.assertRaises(TemplateSyntaxError, FilterExpression, 'article._hidden|upper', p)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/templates/parser.py ParserTests.test_filter_parsing/original