File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -255,17 +255,17 @@ def test_check_yajl_version_warnsOnlyWhenMismatchedVersions(self):
255
255
with mock .patch ('warnings.warn' ) as warn :
256
256
with mock .patch .multiple (yajl .wrapped ,
257
257
__version__ = '1.1.1' ,
258
- yajl_version = '1.1.1' ,
258
+ yajl_version = '1.1.2' , # major and minor version matching
259
259
):
260
260
self .assertTrue (yajl .check_yajl_version ())
261
261
self .assertFalse (warn .called )
262
262
with mock .patch .multiple (yajl .wrapped ,
263
263
__version__ = '1.1.1' ,
264
- yajl_version = '1.1 .0' ,
264
+ yajl_version = '1.0 .0' ,
265
265
):
266
266
self .assertFalse (yajl .check_yajl_version ())
267
267
warn .assert_called_with (
268
- "Using Yajl-Py v1.1.1 with Yajl v1.1 .0. It is advised "
268
+ "Using Yajl-Py v1.1.1 with Yajl v1.0 .0. It is advised "
269
269
"to use the same Yajl-Py and Yajl versions" ,
270
270
RuntimeWarning , stacklevel = 3
271
271
)
Original file line number Diff line number Diff line change 27
27
'YajlParseCancelled' , 'YajlGenException' ,
28
28
'YajlContentHandler' , 'YajlParser' , 'YajlGen' ,
29
29
]
30
- __version__ = '2.1.1 '
30
+ __version__ = '2.1.2 '
31
31
yajl_version = get_yajl_version ()
32
32
33
33
def check_yajl_version ():
@@ -37,7 +37,9 @@ def check_yajl_version():
37
37
Returns True, if the version of yajl is identical to the version of yajl-py
38
38
otherwise displays a RuntimeWarning and returns False.
39
39
'''
40
- if __version__ != yajl_version :
40
+ p_yajl_py_version = __version__ .split ('.' )
41
+ p_yajl_version = yajl_version .split ('.' )
42
+ if p_yajl_py_version [:2 ] != p_yajl_version [:2 ]:
41
43
import warnings
42
44
warnings .warn (
43
45
'Using Yajl-Py v%s with Yajl v%s. '
You can’t perform that action at this time.
0 commit comments