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