Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit 49d0987

Browse files
committed
Error message formatting
1 parent 87c0d7a commit 49d0987

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

coverage/coverage.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" ?>
2-
<coverage branch-rate="1" branches-covered="56" branches-valid="56" complexity="0" line-rate="1" lines-covered="87" lines-valid="87" timestamp="1524608656119" version="4.4.2">
2+
<coverage branch-rate="1" branches-covered="56" branches-valid="56" complexity="0" line-rate="1" lines-covered="87" lines-valid="87" timestamp="1524610853051" version="4.4.2">
33
<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
44
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
55
<sources>

coverage/html/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ <h1>Coverage report:
107107
<div class="content">
108108
<p>
109109
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v4.4.2</a>,
110-
created at 2018-04-24 23:24
110+
created at 2018-04-25 00:00
111111
</p>
112112
</div>
113113
</div>

coverage/html/python_jwt___init___py.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ <h2 class="stats">
362362
<p id="t64" class="stm run hide_run"> <span class="key">if</span> <span class="nam">other_headers</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">None</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
363363
<p id="t65" class="stm run hide_run"> <span class="nam">redefined_keys</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="nam">header</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="op">&amp;</span> <span class="nam">set</span><span class="op">(</span><span class="nam">other_headers</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
364364
<p id="t66" class="stm run hide_run"> <span class="key">if</span> <span class="nam">redefined_keys</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
365-
<p id="t67" class="stm run hide_run"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">'other_headers re-specified the headers: {}'</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">redefined_keys</span><span class="op">)</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
365+
<p id="t67" class="stm run hide_run"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">'other_headers re-specified the headers: {}'</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="str">', '</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">redefined_keys</span><span class="op">)</span><span class="op">)</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
366366
<p id="t68" class="stm run hide_run"> <span class="nam">header</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">other_headers</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
367367
<p id="t69" class="pln"><span class="strut">&nbsp;</span></p>
368368
<p id="t70" class="stm run hide_run"> <span class="nam">claims</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">claims</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
@@ -530,7 +530,7 @@ <h2 class="stats">
530530
<div class="content">
531531
<p>
532532
<a class="nav" href="index.html">&#xab; index</a> &nbsp; &nbsp; <a class="nav" href="https://coverage.readthedocs.io">coverage.py v4.4.2</a>,
533-
created at 2018-04-24 23:24
533+
created at 2018-04-25 00:00
534534
</p>
535535
</div>
536536
</div>

coverage/html/status.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"files":{"python_jwt___init___py":{"index":{"relative_filename":"python_jwt/__init__.py","html_filename":"python_jwt___init___py.html","nums":[1,87,0,0,56,0,0]},"hash":"3878443fd8f9f87f48009d27a91a6f3d"}},"version":"4.4.2","settings":"a3199b6aad875f0076f4863c12dbfc6a","format":1}
1+
{"files":{"python_jwt___init___py":{"index":{"relative_filename":"python_jwt/__init__.py","html_filename":"python_jwt___init___py.html","nums":[1,87,0,0,56,0,0]},"hash":"d105f43a63a29f8229f7ff1eeea8975f"}},"version":"4.4.2","settings":"a3199b6aad875f0076f4863c12dbfc6a","format":1}

python_jwt/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def generate_jwt(claims, priv_key=None,
6464
if other_headers is not None:
6565
redefined_keys = set(header.keys()) & set(other_headers.keys())
6666
if redefined_keys:
67-
raise ValueError('other_headers re-specified the headers: {}'.format(redefined_keys))
67+
raise ValueError('other_headers re-specified the headers: {}'.format(', '.join(redefined_keys)))
6868
header.update(other_headers)
6969

7070
claims = dict(claims)

test/other_headers_vows.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def topic(self):
4545
def should_not_generated_token(self, r):
4646
""" Should not generate """
4747
expect(r).to_be_an_error()
48-
expect(str(r)).to_equal("other_headers re-specified the headers: set(['typ'])")
48+
expect(str(r)).to_equal("other_headers re-specified the headers: typ")
4949

5050
@Vows.batch
5151
#pylint: disable=unused-variable
@@ -60,7 +60,7 @@ def topic(self):
6060
def should_not_generated_token(self, r):
6161
""" Should not generate """
6262
expect(r).to_be_an_error()
63-
expect(str(r)).to_equal("other_headers re-specified the headers: set(['alg'])")
63+
expect(str(r)).to_equal("other_headers re-specified the headers: alg")
6464

6565
other_headers('none', None)
6666
for _alg in algs:

0 commit comments

Comments
 (0)