예제 #1
0
class TestMNCCodesCorrect(WarningTestMixin, unittest.TestCase):
    def setUp(self):
        from mnc_grabber import MNCCodes
        from mnc_grabber import UKE_URL, FILENAME
        self.codes = MNCCodes()

    def test_type(self):
        # check if instance is of hashable type
        self.assertIsInstance(self.codes, collections.Mapping)

    def test_warnings(self):
        from mnc_grabber import MNCCodes
        self.assertWarns(UserWarning,
                         MNCCodes,
                         filename='filename_has_changed')

    def test_invalid_source(self):
        from mnc_grabber import MNCCodes
        self.assertRaises(ValueError, MNCCodes, source='invalid')

    def test_capicity(self):
        self.assertGreater(len(self.codes), 0)

    def test_behaviour(self):
        self.codes['test'] = 'test'
        self.assertEqual(self.codes['test'], 'test')
        self.assertIsNotNone(self.codes.pop('test'))
예제 #2
0
class TestMNCCodesCorrect(WarningTestMixin, unittest.TestCase):

    def setUp(self):
        from mnc_grabber import MNCCodes
        from mnc_grabber import UKE_URL, FILENAME
        self.codes = MNCCodes()

    def test_type(self):
        # check if instance is of hashable type
        self.assertIsInstance(self.codes, collections.Mapping)

    def test_warnings(self):
        from mnc_grabber import MNCCodes
        self.assertWarns(UserWarning,
                         MNCCodes,
                         filename='filename_has_changed')

    def test_invalid_source(self):
        from mnc_grabber import MNCCodes
        self.assertRaises(ValueError, MNCCodes, source='invalid')

    def test_capicity(self):
        self.assertGreater(len(self.codes), 0)

    def test_behaviour(self):
        self.codes['test'] = 'test'
        self.assertEqual(self.codes['test'], 'test')
        self.assertIsNotNone(self.codes.pop('test'))
예제 #3
0
 def setUp(self):
     from mnc_grabber import MNCCodes
     from mnc_grabber import UKE_URL, FILENAME
     self.codes = MNCCodes()
예제 #4
0
    def test_type(self):
        # check if instance is of hashable type
        self.assertIsInstance(self.codes, collections.Mapping)

    def test_warnings(self):
        from mnc_grabber import MNCCodes
        self.assertWarns(UserWarning,
                         MNCCodes,
                         filename='filename_has_changed')

    def test_invalid_source(self):
        from mnc_grabber import MNCCodes
        self.assertRaises(ValueError, MNCCodes, source='invalid')

    def test_capicity(self):
        self.assertGreater(len(self.codes), 0)

    def test_behaviour(self):
        self.codes['test'] = 'test'
        self.assertEqual(self.codes['test'], 'test')
        self.assertIsNotNone(self.codes.pop('test'))


if __name__ == '__main__':
    from mnc_grabber import MNCCodes
    codes = MNCCodes()
    for idx, item in enumerate(
            sorted(codes.iteritems(), key=operator.itemgetter(1))):
        print str(idx + 1) + '.\t' + ' - '.join(item)
    unittest.main()
예제 #5
0
 def setUp(self):
     from mnc_grabber import MNCCodes
     from mnc_grabber import UKE_URL, FILENAME
     self.codes = MNCCodes()
예제 #6
0
    def test_type(self):
        # check if instance is of hashable type
        self.assertIsInstance(self.codes, collections.Mapping)

    def test_warnings(self):
        from mnc_grabber import MNCCodes
        self.assertWarns(UserWarning,
                         MNCCodes,
                         filename='filename_has_changed')

    def test_invalid_source(self):
        from mnc_grabber import MNCCodes
        self.assertRaises(ValueError, MNCCodes, source='invalid')

    def test_capicity(self):
        self.assertGreater(len(self.codes), 0)

    def test_behaviour(self):
        self.codes['test'] = 'test'
        self.assertEqual(self.codes['test'], 'test')
        self.assertIsNotNone(self.codes.pop('test'))


if __name__ == '__main__':
    from mnc_grabber import MNCCodes
    codes = MNCCodes()
    for idx, item in enumerate(sorted(codes.iteritems(), key=operator.itemgetter(1))):
        print str(idx+1) + '.\t' + ' - '.join(item)
    unittest.main()