def test_write_arguments(self): """Check how the write methods respond to output format arguments.""" gdd = Diagram('Test Diagram') gdd.drawing = None # Hack - need the ReportLab drawing object to be created. filename = os.path.join("Graphics", "error.txt") # We (now) allow valid formats in any case. for output in ["XXX", "xxx", None, 123, 5.9]: with self.assertRaises(ValueError): gdd.write(filename, output) with self.assertRaises(ValueError): gdd.write_to_string(output)
def test_write_arguments(self): """Check how the write methods respond to output format arguments.""" gdd = Diagram("Test Diagram") gdd.drawing = None # Hack - need the ReportLab drawing object to be created. filename = os.path.join("Graphics", "error.txt") # We (now) allow valid formats in any case. for output in ["XXX", "xxx", None, 123, 5.9]: with self.assertRaises(ValueError): gdd.write(filename, output) with self.assertRaises(ValueError): gdd.write_to_string(output)
def test_write_arguments(self): """Check how the write methods respond to output format arguments.""" gdd = Diagram('Test Diagram') gdd.drawing = None # Hack - need the ReportLab drawing object to be created. filename = os.path.join("Graphics", "error.txt") # We (now) allow valid formats in any case. for output in ["XXX", "xxx", None, 123, 5.9]: try: gdd.write(filename, output) assert False, \ "Should have rejected %s as an output format" % output except ValueError as e: # Good! pass try: gdd.write_to_string(output) assert False, \ "Should have rejected %s as an output format" % output except ValueError as e: # Good! pass
def test_write_arguments(self): """Check how the write methods respond to output format arguments.""" gdd = Diagram('Test Diagram') gdd.drawing = None # Hack - need the ReportLab drawing object to be created. filename = os.path.join("Graphics","error.txt") #We (now) allow valid formats in any case. for output in ["XXX","xxx",None,123,5.9]: try: gdd.write(filename, output) assert False, \ "Should have rejected %s as an output format" % output except ValueError as e: #Good! pass try: gdd.write_to_string(output) assert False, \ "Should have rejected %s as an output format" % output except ValueError as e: #Good! pass