title: test a custom template tag filter in django
body: <p>To use a template filter like so in a <code>sample_template.html</code> :</p>
  
  <pre><code>{% load truck_filters %}
  &lt;div data-toggle="tooltip" data-placement="bottom" data-ten-condition='{{model.0|tenRange}}'&gt;{{model.0}}&lt;/div&gt;
  # would render
  &lt;div data-toggle="tooltip" data-placement="bottom" data-ten-condition='0'&gt;10&lt;/div&gt;
  </code></pre>
  
  <p>I have an <code>app_filter.py</code> in a folder <code>templatetags</code> in the app:</p>
  
  <pre><code>from django import template
  register = template.Library()
  
  @register.filter(name='tenRange')
  def tenRange(numberString):
    # If it is blank
    if numberString == '':
      return -1
    number = int(numberString)
    lowerLimit  = 3
    mediumLimit = 5
    medium2Limit = 8
    newLimit  = 10
    if number &lt; -1:
      return -2
    elif 0 &lt;= number and number &lt; lowerLimit:
      return 3
    elif lowerLimit &lt;= number and number &lt; mediumLimit:
      return 2
    elif mediumLimit &lt;= number and number &lt;= medium2Limit:
      return 1
    elif medium2Limit &lt;= number and number &lt;= newLimit:
      return 0
    # If above the new limit
    elif number &gt; newLimit:
      return -1
    # If there is an error
    else:
      return -1
  </code></pre>
  
  <p>How would I [unit?] test the conditions (with different ints, variable types, etc...) in <code>test_template_tags.py</code> in the <code>tests</code> folder?</p>
  
  <p>My current limited understanding...
     I can't seem to find a good working example, and the docs hint at rendering a template with a specific context.  I'm not sure that is required, but if it is (convention), then can you please help provide how to provide a template and context? (is it the same as rendering it from the view?, if so, how do you just find the one portion that I am trying to test without bloating the other required variables to be rendered?)</p>