File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1990,15 +1990,20 @@ def test_parse_magicmock_raises_error(self):
19901990 an infinite loop when passed a MagicMock (e.g., from an improperly
19911991 mocked requests.Response.content).
19921992 '''
1993- from unittest .mock import MagicMock
1993+ try :
1994+ from unittest .mock import MagicMock
1995+ except ImportError :
1996+ from mock import MagicMock # Python 2.7
19941997 mock = MagicMock ()
19951998 with self .assertRaises (llsd .LLSDParseError ) as context :
19961999 llsd .parse (mock )
19972000 self .assertIn ('MagicMock' , str (context .exception ))
19982001
2002+ @unittest .skipIf (PY2 , "str is bytes in Python 2" )
19992003 def test_parse_string_raises_error (self ):
20002004 '''
20012005 Parsing a string (not bytes) should raise LLSDParseError.
2006+ Only applies to Python 3 where str and bytes are distinct.
20022007 '''
20032008 with self .assertRaises (llsd .LLSDParseError ) as context :
20042009 llsd .parse ('not bytes' )
You can’t perform that action at this time.
0 commit comments