def test_demos(self): """Ensure that demo data is parsed successfully and doesn't produce exceptions or unknown results""" for d in demodata: ntp = NTPCheck(d.split("\n")) ntp.dump() methods = [ntp.check_offset, ntp.check_peers, ntp.check_reachability, ntp.check_sync, ntp.checks] for method in methods: ret = method() self.assertIn( ret, [0, 1, 2], "Method %s returned invalid result parsing demo data:\n%s\nTry running with --show-demos." % (method, d))
def demo(): """Duplicate of test_demos which shows full output""" i = 0 for d in demodata: print("Parsing demo data %d: %s" % (i, d)) ntp = NTPCheck(d.split("\n")) i += 1 ntp.dump() methods = [ntp.check_offset, ntp.check_peers, ntp.check_reachability, ntp.check_sync, ntp.checks] for method in methods: ret = method() if ret not in [0, 1, 2]: print("Method %s returned invalid result parsing demo data:\n%s" % (method, d)) sys.exit(3)
def test_demos(self): """Ensure that demo data is parsed successfully and doesn't produce exceptions or unknown results""" for d in demodata: ntp = NTPCheck(d.split("\n")) ntp.dump() methods = [ ntp.check_offset, ntp.check_peers, ntp.check_reachability, ntp.check_sync, ntp.checks ] for method in methods: ret = method() self.assertIn( ret, [0, 1, 2], "Method %s returned invalid result parsing demo data:\n%s\nTry running with --show-demos." % (method, d))
def demo(): """Duplicate of test_demos which shows full output""" i = 0 for d in demodata: print("Parsing demo data %d: %s" % (i, d)) ntp = NTPCheck(d.split("\n")) i += 1 ntp.dump() methods = [ ntp.check_offset, ntp.check_peers, ntp.check_reachability, ntp.check_sync, ntp.checks ] for method in methods: ret = method() if ret not in [0, 1, 2]: print( "Method %s returned invalid result parsing demo data:\n%s" % (method, d)) sys.exit(3)