@@ -33,7 +33,7 @@ def ordinal(value):
3333 '101st'
3434 >>> ordinal(111)
3535 '111th'
36- >>> ordinal(' something else' )
36+ >>> ordinal(" something else" )
3737 'something else'
3838 >>> ordinal(None) is None
3939 True
@@ -71,6 +71,7 @@ def intcomma(value, ndigits=None):
7171
7272 For example, 3000 becomes "3,000" and 45000 becomes "45,000". To maintain some
7373 compatibility with Django's `intcomma`, this function also accepts floats.
74+
7475 Examples:
7576 ``pycon
7677 >>> intcomma(100)
@@ -138,6 +139,7 @@ def intword(value, format="%.1f"):
138139 Works best for numbers over 1 million. For example, 1_000_000 becomes "1.0 million",
139140 1200000 becomes "1.2 million" and "1_200_000_000" becomes "1.2 billion". Supports up
140141 to decillion (33 digits) and googol (100 digits).
142+
141143 Examples:
142144 ```pycon
143145 >>> intword("100")
@@ -184,24 +186,25 @@ def intword(value, format="%.1f"):
184186def apnumber (value ):
185187 """Converts an integer to Associated Press style.
186188
189+ Examples:
190+ ```pycon
191+ >>> apnumber(0)
192+ 'zero'
193+ >>> apnumber(5)
194+ 'five'
195+ >>> apnumber(10)
196+ '10'
197+ >>> apnumber("7")
198+ 'seven'
199+ >>> apnumber("foo")
200+ 'foo'
201+ >>> apnumber(None) is None
202+ True
203+
204+ ```
187205 Args:
188206 value (int, float, str): Integer to convert.
189- Examples:
190- ```pycon
191- >>> apnumber(0)
192- 'zero'
193- >>> apnumber(5)
194- 'five'
195- >>> apnumber(10)
196- '10'
197- >>> apnumber("7")
198- 'seven'
199- >>> apnumber("foo")
200- 'foo'
201- >>> apnumber(None) is None
202- True
203207
204- ```
205208 Returns:
206209 str: For numbers 0-9, the number spelled out. Otherwise, the number. This always
207210 returns a string unless the value was not `int`-able, unlike the Django filter.
@@ -243,7 +246,6 @@ def fractional(value):
243246
244247 Examples:
245248 ```pycon
246-
247249 >>> fractional(0.3)
248250 '3/10'
249251 >>> fractional(1.3)
0 commit comments