from datetime import datetime
import sys
import unittest

import btceapi


class TestScraping(unittest.TestCase):
    def test_scrape_main_page(self):
        mainPage = btceapi.scrapeMainPage()
        for message in mainPage.messages:
            msgId, user, time, text = message
            self.assertIs(type(time), datetime)
            if sys.version_info[0] == 2:
                # python2.x
                self.assertIn(type(msgId), (str, unicode))
                self.assertIn(type(user), (str, unicode))
                self.assertIn(type(text), (str, unicode))
            else:
                # python3.x
                self.assertIs(type(msgId), str)
                self.assertIs(type(user), str)
                self.assertIs(type(text), str)


if __name__ == '__main__':
    unittest.main()

from datetime import datetime
import sys
import unittest

import btceapi


class TestScraping(unittest.TestCase):
    def test_scrape_main_page(self):
        mainPage = btceapi.scrapeMainPage()
        for message in mainPage.messages:
            msgId, user, time, text = message
            assert type(time) is datetime
            if sys.version_info[0] == 2:
                # python2.x
                self.assertIn(type(msgId), (str, unicode))
                self.assertIn(type(user), (str, unicode))
                self.assertIn(type(text), (str, unicode))
            else:
                # python3.x
                self.assertIs(type(msgId), str)
                self.assertIs(type(user), str)
                self.assertIs(type(text), str)


if __name__ == '__main__':
    unittest.main()

Fix for assertIs method not being present in Python 2.6.
Fix for assertIs method not being present in Python 2.6.
