Add test for xml_bool and correct implementation, simplify by using json.

This commit is contained in:
Jason R. Coombs 2016-09-04 11:23:22 -04:00
parent 7d8cc32331
commit 2c2ba47879

View File

@ -1,4 +1,5 @@
import itertools
import json
from six.moves import urllib, map
@ -125,11 +126,13 @@ class Subpod(Document):
def xml_bool(str_val):
return (
bool(int(str_val))
if str_val.isdigit() else
str_val.lower() != 'true'
)
"""
>>> xml_bool('true')
True
>>> xml_bool('false')
False
"""
return bool(json.loads(str_val))
class Pod(ErrorHandler, Document):