def testTextInStderr(self):
        obj = ConsoleDiffer(name='diff', text_in_stderr='andrew')
        obj.execute(0, 'andrew', 'andrew')
        self.assertEqual(obj.status(), 0)

        with self.assertLogs(level='ERROR') as log:
            obj.execute(0, 'andrew', '')
        self.assertEqual(len(log.output), 1)
        self.assertIn(
            "The content of 'text_in_stderr' parameter, 'andrew', was not located in the output",
            log.output[0])
        self.assertEqual(obj.status(), 1)
    def testReMatchStderr(self):
        obj = ConsoleDiffer(name='diff', re_match_stderr='\d{4}-\d{2}-\d{2}')
        obj.execute(0, '1980-06-24', '1980-06-24')
        self.assertEqual(obj.status(), 0)

        with self.assertLogs(level='ERROR') as log:
            obj.execute(0, '1980-06-24', '198-06-24')
        self.assertEqual(len(log.output), 1)
        self.assertIn(
            "The regular expression of 're_match_stderr' parameter, '\\d{4}-\\d{2}-\\d{2}', did not produce a match in the output of sys.stderr:\n198-06-24",
            log.output[0])
        self.assertEqual(obj.status(), 1)
    def testTextNotIn(self):
        obj = ConsoleDiffer(name='diff', text_not_in='andrew')
        obj.execute(0, 'bob', 'julie')
        self.assertEqual(obj.status(), 0)

        with self.assertLogs(level='ERROR') as log:
            obj.execute(0, 'andrew', '')
        self.assertEqual(len(log.output), 1)
        self.assertIn(
            "The content of 'text_not_in' parameter, 'andrew', was located in the output",
            log.output[0])
        self.assertEqual(obj.status(), 1)

        obj.reset()
        with self.assertLogs(level='ERROR') as log:
            obj.execute(0, '', 'andrew')
        self.assertEqual(len(log.output), 1)
        self.assertIn(
            "The content of 'text_not_in' parameter, 'andrew', was located in the output",
            log.output[0])
        self.assertEqual(obj.status(), 1)
 def testDefault(self):
     obj = ConsoleDiffer(name='diff')
     obj.execute(0, '', '')
     self.assertEqual(obj.status(), 0)