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):
255255 with mock .patch ('warnings.warn' ) as warn :
256256 with mock .patch .multiple (yajl .wrapped ,
257257 __version__ = '1.1.1' ,
258- yajl_version = '1.1.1' ,
258+ yajl_version = '1.1.2' , # major and minor version matching
259259 ):
260260 self .assertTrue (yajl .check_yajl_version ())
261261 self .assertFalse (warn .called )
262262 with mock .patch .multiple (yajl .wrapped ,
263263 __version__ = '1.1.1' ,
264- yajl_version = '1.1 .0' ,
264+ yajl_version = '1.0 .0' ,
265265 ):
266266 self .assertFalse (yajl .check_yajl_version ())
267267 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 "
269269 "to use the same Yajl-Py and Yajl versions" ,
270270 RuntimeWarning , stacklevel = 3
271271 )
Original file line number Diff line number Diff line change 2727 'YajlParseCancelled' , 'YajlGenException' ,
2828 'YajlContentHandler' , 'YajlParser' , 'YajlGen' ,
2929]
30- __version__ = '2.1.1 '
30+ __version__ = '2.1.2 '
3131yajl_version = get_yajl_version ()
3232
3333def check_yajl_version ():
@@ -37,7 +37,9 @@ def check_yajl_version():
3737 Returns True, if the version of yajl is identical to the version of yajl-py
3838 otherwise displays a RuntimeWarning and returns False.
3939 '''
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 ]:
4143 import warnings
4244 warnings .warn (
4345 'Using Yajl-Py v%s with Yajl v%s. '
You can’t perform that action at this time.
0 commit comments