# Path: likert_field/templatetags/likert_star_tools.py
# def render_stars(num, max_stars, star_set):
#     """
#     Star renderer returns a HTML string of stars
# 
#     If num is None or a blank string, it returns the unanswered tag
# 
#     Otherwise, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
# 
#     If num > max_stars, render max_stars solid stars
# 
#     star_set is a dictionary of strings with keys: star, unlit, noanswer
#     """
#     if num is None or (isinstance(num, string_types) and len(num) == 0):
#         return star_set['noanswer']
# 
#     difference = int(max_stars) - int(num)
#     if difference < 0:
#         num = max_stars
#         difference = 0
# 
#     return ''.join(
#         star_set['star'] * int(num) + star_set['unlit'] * difference)
# 
# Path: likert_field/templatetags/likert_fa_stars.py
# def fa_stars3(num, max_stars=5):
#     """
#     Stars for Font Awesome 3
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_3))
# 
# def fa_stars4(num, max_stars=5):
#     """
#     Stars for Font Awesome 4
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_4))
# 
# Path: likert_field/templatetags/likert_bs_stars.py
# def bs_stars2(num, max_stars=5):
#     """
#     Stars for Bootstrap 2
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_2))
# 
# def bs_stars3(num, max_stars=5):
#     """
#     Stars for Bootstrap 3
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_3))
# 
# def bs_stars3_bsr(num, max_stars=5):
#     """
#     Stars for Bootstrap 3 w bootstrap-star-rating
# 
#     BSR uses a minus sign for an empty response
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_3_bsr))


from django.test import SimpleTestCase
from django.utils.six.moves import xrange
from likert_field.templatetags.likert_star_tools import render_stars
from likert_field.templatetags.likert_fa_stars import fa_stars3, fa_stars4
from likert_field.templatetags.likert_bs_stars import (
    bs_stars2, bs_stars3, bs_stars3_bsr)
    def test_bs_stars2_render_noanswer(self):
        num = None
        expected_stars = "<i class='icon-ban-circle likert-star'></i>"
        stars = bs_stars2(num)
        self.assertEqual(stars, expected_stars)

    def test_bs_stars3_render(self):
        num = 1
        expected_stars = (
            "<i class='glyphicon glyphicon-star likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>")
        stars = bs_stars3(num)
        self.assertEqual(stars, expected_stars)

    def test_bs_stars3_render_parameters(self):
        num = 1
        max_stars = 2
        expected_stars = (
            "<i class='glyphicon glyphicon-star likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>")
        stars = bs_stars3(num, max_stars)
        self.assertEqual(stars, expected_stars)

    def test_bs_stars3_render_noanswer(self):
        num = None
        expected_stars = (
            "<i class='glyphicon glyphicon-ban-circle likert-star'></i>")

# Path: likert_field/templatetags/likert_star_tools.py
# def render_stars(num, max_stars, star_set):
#     """
#     Star renderer returns a HTML string of stars
# 
#     If num is None or a blank string, it returns the unanswered tag
# 
#     Otherwise, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
# 
#     If num > max_stars, render max_stars solid stars
# 
#     star_set is a dictionary of strings with keys: star, unlit, noanswer
#     """
#     if num is None or (isinstance(num, string_types) and len(num) == 0):
#         return star_set['noanswer']
# 
#     difference = int(max_stars) - int(num)
#     if difference < 0:
#         num = max_stars
#         difference = 0
# 
#     return ''.join(
#         star_set['star'] * int(num) + star_set['unlit'] * difference)
# 
# Path: likert_field/templatetags/likert_fa_stars.py
# def fa_stars3(num, max_stars=5):
#     """
#     Stars for Font Awesome 3
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_3))
# 
# def fa_stars4(num, max_stars=5):
#     """
#     Stars for Font Awesome 4
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_4))
# 
# Path: likert_field/templatetags/likert_bs_stars.py
# def bs_stars2(num, max_stars=5):
#     """
#     Stars for Bootstrap 2
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_2))
# 
# def bs_stars3(num, max_stars=5):
#     """
#     Stars for Bootstrap 3
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_3))
# 
# def bs_stars3_bsr(num, max_stars=5):
#     """
#     Stars for Bootstrap 3 w bootstrap-star-rating
# 
#     BSR uses a minus sign for an empty response
# 
#     If num is not None, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
#     """
#     return mark_safe(render_stars(num, max_stars, star_set_3_bsr))


# Path: test_suite/test_templatetags.py
from django.test import SimpleTestCase
from django.utils.six.moves import xrange
from likert_field.templatetags.likert_star_tools import render_stars
from likert_field.templatetags.likert_fa_stars import fa_stars3, fa_stars4
from likert_field.templatetags.likert_bs_stars import (
    bs_stars2, bs_stars3, bs_stars3_bsr)

    def test_bs_stars2_render_noanswer(self):
        num = None
        expected_stars = "<i class='icon-ban-circle likert-star'></i>"
        stars = bs_stars2(num)
        self.assertEqual(stars, expected_stars)

    def test_bs_stars3_render(self):
        num = 1
        expected_stars = (
            "<i class='glyphicon glyphicon-star likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>")
        stars = bs_stars3(num)
        self.assertEqual(stars, expected_stars)

    def test_bs_stars3_render_parameters(self):
        num = 1
        max_stars = 2
        expected_stars = (
            "<i class='glyphicon glyphicon-star likert-star'></i>"
            "<i class='glyphicon glyphicon-star-empty likert-star'></i>")
        stars = bs_stars3(num, max_stars)
        self.assertEqual(stars, expected_stars)

    def test_bs_stars3_render_noanswer(self):
        num = None
        expected_stars = (
            "<i class='glyphicon glyphicon-ban-circle likert-star'></i>")

        stars = bs_stars3(num)