def test_dict2uri_nonetype(self): d = dict(code='by', version='3.0', jurisdiction=None) assert lib.dict2uri(d) == 'http://creativecommons.org/licenses/by/3.0/' e = dict(code='by') assert lib.dict2uri(e) == 'http://creativecommons.org/licenses/by/3.0/' f = dict(code='by-sa', version='1.0') assert lib.dict2uri(f) == 'http://creativecommons.org/licenses/by-sa/1.0/'
def test_dict2uri_empty_values(self): dicts = [ dict(jurisdiction=None, version='', code='sampling+'), dict(jurisdiction=None, version=None, code='sampling+'), dict(jurisdiction='', version='', code='sampling+'), dict(jurisdiction='', version=None, code='sampling+') ] for d in dicts: assert lib.dict2uri(d) == \ 'http://creativecommons.org/licenses/sampling+/1.0/'
def test_uri_commutativity(self): for uri in self.uris: assert uri == lib.dict2uri(lib.uri2dict(uri))