Exemplo n.º 1
0
 def test_function_main_work_with_correct_input(self, input):
     """
     Test to check main function works.
     """
     return_value = triangle.main(triangle.parse_input,
                                  triangle.Triangle.apex_of_triangle)
     self.assertEqual(return_value, 'Площадь треуголиника равна : 24.0',
                      'Main function did not work')
Exemplo n.º 2
0
 def test_function_main_try_to_return_whitespace_coordinate_wronge_negative(
         self, out):
     """
     Test with not givin value
     """
     with unittest.mock.patch('builtins.input',
                              side_effect=['']) as fake_input:
         value = triangle.main(triangle.parse_input,
                               triangle.Triangle.apex_of_triangle)
     self.assertEqual(value, ' ')
Exemplo n.º 3
0
 def test_function_main_try_to_give_incorrec_value_negative(self, input):
     """
     Example that all tests above works fine.
     """
     capturedOut = io.StringIO()
     sys.stdout = capturedOut
     return_value = triangle.main(triangle.parse_input,
                                  triangle.Triangle.apex_of_triangle)
     sys.stdout = sys.__stdout__
     self.assertEqual(
         capturedOut.getvalue(),
         'Вычисление площади Герона по координатам.\n'
         'Points ((1.0, 3.0), (1.0, 9.0), (1.0, 1.0)) do not form a triangle\n',
         'Output did not work')
     self.assertEqual(return_value, ' ')
Exemplo n.º 4
0
 def init(self):
     # All of this gets executed in JS
     super().init()
     with flx.HBox():
         self.canvas = WgpuCanvas()
     triangle.main(self.canvas)
Exemplo n.º 5
0
import math
from time import perf_counter

import glfw
from wgpu.gui.glfw import update_glfw_canvasses, WgpuCanvas
import wgpu.backends.rs  # noqa: F401, Select Rust backend

# Import the function that we must call to run the visualization
from triangle import main


glfw.init()
glfw.ERROR_REPORTING = "warn"
canvas = WgpuCanvas(title="wgpu triangle with GLFW")
main(canvas)


def simple_event_loop():
    """ A real simple event loop, but it keeps the CPU busy. """
    while update_glfw_canvasses():
        glfw.poll_events()


def better_event_loop(max_fps=100):
    """ A simple event loop that schedules draws. """
    td = 1 / max_fps
    while update_glfw_canvasses():
        # Determine next time to draw
        now = perf_counter()
        tnext = math.ceil(now / td) * td
Exemplo n.º 6
0
import time
import sys
import random

import rombo
import _rombo
import square
import triangle
import triangle_inv
import triangle_rec

while True:
        _num = random.randint(3,54)
        moon =random.randint(3,54)
        token =random.randint(1,6)
        if token == 1:
            square.main()
        if token == 2:
            rombo.main()
        if token == 3:
            triangle.main()
        if token == 4:
            triangle_rec.main()
        if token == 5:
            triangle_inv.main()
        if token == 6:
                _rombo.main()