Giter Club home page Giter Club logo

oopyrate_boss's Introduction

OOPyrate_Boss

En este repositorio podrá encontrar el esquema de Unit Test basado en pytest, apra realizar las pruebas unitarias del mini TP TP_OOPirate.
La prueba del TP se realiza de forma automatizada utilizando Github Actions y se activará cuando se realice PUSH en la rama ENTREGA.
Cuantos más TESTS PASS tenga el TP, mejor valoración.

Se realizará la prueba de las tres clases (Ship, Cruise & Cargo), como también se realizará un test general.
El test general, descarga un archivo con muchos datos y llevará el código a sus limites.

Test Cases

test_ships.py

def test_is_ship() -> None:
    listaShip: list[int, int] = [ """static data set""" ]
    
    with pytest.raises(ValueError):
        for ship in listaShip:
            ship: Ship = Ship(ship[0], ship[1])
            assert (ship.is_worth_it() >= 20) == True 

test_cargos.py

def test_is_cargo() -> None:
    listaCargos: list[int, float, int, int] = [ """static data set""" ]
    
    with pytest.raises(ValueError): 
        for cargo in listaCargos:
            cargo: Cargo = Cargo(cargo[0], cargo[1], cargo[2], cargo[3])
            assert (cargo.is_worth_it() >= 20) == True

test_cruises.py

def test_is_Cruise() -> None:
    listaCruise: list[int, int, int] = [ """static data set""" ]
    
    with pytest.raises(ValueError):
        for cruise in listaCruise:
            cruise: Cruise = Cruise(cruise[0], cruise[1], cruise[2])
            assert (cruise.is_worth_it() >= 20) == True 

test_luffy.py

def test_with_file():
    url="https://my.api.mockaroo.com/oop_pirate.csv?key=<key>"
    
    try:
        ShipLists = csv.reader(codecs.iterdecode(requests.get(url).iter_lines(), encoding="utf-8"), delimiter=",")
    except (requests.exceptions.ConnectionError, requests.exceptions.RequestException):
        ...
    else:
        myShips: list[any] = []
        header: bool = True
        for ship in ShipLists:
            if not header:
                try:
                    if ship[2] == '' and ship[3] == '':
                        myShips.append(Ship(int(ship[0]), int(ship[1])))
                    elif ship[3] == '':
                        myShips.append(Cruise(int(ship[2]), int(ship[0]), int(ship[1])))
                    else:
                        if ship[2] == '':
                            continue
                        myShips.append(Cargo(int(ship[2]), float(ship[3]), int(ship[0]), int(ship[1])))
                except ValueError:
                    continue
            else:
                header = False
        with pytest.raises(ValueError):
            for ship_ in myShips:
                assert (ship_.is_worth_it() >= 20) == True

UF-FICEN LP2 2023 - Ezequiel Augusto Stanganelli

oopyrate_boss's People

Contributors

eastanganelli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.