def test_summary_output(self): summary = [{ "testOperator0": { "version": "1.0.0", "pass": True, "skipped": False, "tests": { "is in allowed list": True } } }, { "testOperator1": { "version": "2.2.40", "pass": True, "skipped": True, "tests": { "is already curated": True } } }] expected_output = ("Validation Summary\n" + "------------------\n" + "\n" + "[PASS] testOperator0 version 1.0.0\n" + " [PASS] is in allowed list\n" + "\n" + "[PASS] testOperator1 version 2.2.40\n" + " [SKIP] is already curated\n" + "\n" + "Passed Curation: 1\n" + "Already Curated: 1\n" + "Failed Curation: 0") out = StringIO() curator.summarize(summary, out=out) output = out.getvalue().strip() self.assertEqual(output, expected_output)
def test_summary_single_element(self): summary = [{ "testOperator0": { "version": "1.0.0", "pass": False, "skipped": False, "tests": { "is in allowed list": False } } }] expected_output = ("Validation Summary\n" + "------------------\n" + "\n" + "[FAIL] testOperator0 version 1.0.0\n" + " [FAIL] is in allowed list\n" + "\n" + "Passed Curation: 0\n" + "Already Curated: 0\n" + "Failed Curation: 1") out = StringIO() curator.summarize(summary, out=out) output = out.getvalue().strip() self.assertEqual(output, expected_output)
def test_summary_is_list(self): summary = {} with self.assertRaises(TypeError): curator.summarize(summary)
def test_summary_no_results(self): summary = [] with self.assertRaises(IndexError): curator.summarize(summary)