django.template.defaultfilters.stringformat - python examples

Here are the examples of the python api django.template.defaultfilters.stringformat taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

3 View Complete Implementation : test_stringformat.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_format(self):
        self.astertEqual(stringformat(1, '03d'), '001')
        self.astertEqual(stringformat([1, None], 's'), '[1, None]')
        self.astertEqual(stringformat((1, 2, 3), 's'), '(1, 2, 3)')
        self.astertEqual(stringformat((1,), 's'), '(1,)')
        self.astertEqual(stringformat({1, 2}, 's'), '{1, 2}')
        self.astertEqual(stringformat({1: 2, 2: 3}, 's'), '{1: 2, 2: 3}')

0 View Complete Implementation : test_stringformat.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_invalid(self):
        self.astertEqual(stringformat(1, 'z'), '')
        self.astertEqual(stringformat(object(), 'd'), '')
        self.astertEqual(stringformat(None, 'd'), '')
        self.astertEqual(stringformat((1, 2, 3), 'd'), '')