Пример #1
0
    def test_seterrcall(self):
        def foo(x):
            return 10

        seterrcall('sampmdsize', foo)
        obs = geterrcall('sampmdsize')
        self.assertEqual(obs, foo)
Пример #2
0
    def test_errstate(self):
        def foo(item):
            return "the callback called"

        table = Table([], [], [])
        seterrcall('empty', foo)
        self.assertNotEqual(geterr()['empty'], 'call')
        with errstate(empty='call'):
            result = errcheck(table)
        self.assertEqual(result, "the callback called")
        self.assertNotEqual(geterr()['empty'], 'call')