2005-10-25 09:44:14 +08:00
|
|
|
"""
|
2005-11-27 06:46:31 +08:00
|
|
|
>>> floatformat(7.7)
|
2005-10-25 09:44:14 +08:00
|
|
|
'7.7'
|
2005-11-27 06:46:31 +08:00
|
|
|
>>> floatformat(7.0)
|
2005-10-25 09:44:14 +08:00
|
|
|
'7'
|
2005-11-27 06:46:31 +08:00
|
|
|
>>> floatformat(0.7)
|
2005-10-25 09:44:14 +08:00
|
|
|
'0.7'
|
2005-11-27 06:46:31 +08:00
|
|
|
>>> floatformat(0.07)
|
2005-10-25 09:44:14 +08:00
|
|
|
'0.1'
|
2005-11-27 06:46:31 +08:00
|
|
|
>>> floatformat(0.007)
|
2005-10-25 09:44:14 +08:00
|
|
|
'0.0'
|
2005-11-27 06:46:31 +08:00
|
|
|
>>> floatformat(0.0)
|
2005-10-25 09:44:14 +08:00
|
|
|
'0'
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.core.template.defaultfilters import *
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import doctest
|
|
|
|
doctest.testmod()
|