Beispiel #1
0
def main():
    img_path, scaling_ratio, output_format, font_size, line_height = init()
    filename = img_path.split('.')[0]
    asciiart = AsciiArt(img_path)
    if output_format == 0:
        asciiart.save_as_txt_file(scaling_ratio, filename)
    elif output_format == 1:
        asciiart.save_as_html_file(scaling_ratio, filename, font_size,
                                   line_height)
    elif output_format == 2:
        asciiart.save_as_txt_file(scaling_ratio, filename)
        asciiart.save_as_html_file(scaling_ratio, filename, font_size,
                                   line_height)
    else:
        raise ValueError('Possible values are 0, 1 and 2.')
Beispiel #2
0
 def test_object_creation(self):
     self.assertIsInstance(AsciiArt(), AsciiArt)
Beispiel #3
0
 def test_calculate_pixel_size(self):
     AsciiObj = AsciiArt("epam.png")
     ps = AsciiObj._calculate_pixel_size()
     self.assertAlmostEqual(ps, 288 / 100, 2)
Beispiel #4
0
 def test_draw_method(self):
     AsciiObj = AsciiArt("epam.png")
     img = AsciiObj.draw()
     self.assertGreater(len(img), 0)