fix: Make python2 happy.

pull/175/head
Raphaël Vinot 2018-01-12 00:45:34 +01:00
parent 5520cf1261
commit 4e36ac34dc
1 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,7 @@
import unittest
import json
import sys
from io import BytesIO
from pymisp import MISPEvent, MISPSighting, MISPTag
@ -240,7 +241,11 @@ class TestMISPEvent(unittest.TestCase):
with self.assertRaises(InvalidMISPObject) as e:
# Fail on required
self.mispevent.to_json()
self.assertEqual(e.exception.message, '{\'member3\'} are required.')
if sys.version_info >= (3, ):
self.assertEqual(e.exception.message, '{\'member3\'} are required.')
else:
# Python2 bullshit
self.assertEqual(e.exception.message, 'set([u\'member3\']) are required.')
self.mispevent.objects[0].add_attribute('member3', value='foo')
with self.assertRaises(InvalidMISPObject) as e: