Example #1
0
 def test_boolean(self):
     # False if no errors or warnings
     report = sbol3.ValidationReport()
     self.assertEqual(False, bool(report))
     # True if any errors
     report.addError(None, None, 'Fake error')
     self.assertEqual(True, bool(report))
     # True if any warnings
     report = sbol3.ValidationReport()
     report.addWarning(None, None, 'Fake warning')
     self.assertEqual(True, bool(report))
     # True if both errors and warnings
     report = sbol3.ValidationReport()
     report.addError(None, None, 'Fake error')
     report.addWarning(None, None, 'Fake warning')
     self.assertEqual(True, bool(report))
Example #2
0
 def test_length(self):
     # Length should be the sum of errors and warnings
     report = sbol3.ValidationReport()
     self.assertEqual(0, len(report))
     report.addError(None, None, 'Fake error')
     self.assertEqual(1, len(report))
     report.addWarning(None, None, 'Fake warning')
     self.assertEqual(2, len(report))
Example #3
0
 def test_str(self):
     # str representation should consist of errors and warnings
     # all errors precede any warning
     report = sbol3.ValidationReport()
     self.assertEqual('', str(report))
     report.addError(None, None, 'Fake error')
     self.assertEqual('Fake error', str(report))
     report.addWarning(None, None, 'Fake warning')
     self.assertEqual('Fake error\nFake warning', str(report))
     report.addError(None, None, 'Fake error')
     self.assertEqual('Fake error\nFake error\nFake warning', str(report))