GithubHelp home page GithubHelp logo

classworkfall2021's Issues

Making the Unit test excersize

The test code can be found in these lines of the unit test file

@pytest.mark.parametrize("my_input_1, my_input_2, my_input_3, expected", [
((1, 2), (2, 4), 3, 6),
((0, 4), (4, 10), 2, 7)])
def test_xy_calc(my_input_1, my_input_2, my_input_3, expected):
from x_to_y import get_new_y
answer = get_new_y(my_input_1, my_input_2, my_input_3)
assert answer == expected

Finished unit test function

Here is the completed unit test function

def get_new_y(tupe_1: tuple, tupe_2: tuple, new_x):
assert len(tupe_1) == 2
x1, y1 = tupe_1[:]
assert len(tupe_2) == 2
x2, y2 = tupe_2[:]
for i in (x1, y1, x2, y2, new_x):
assert is_numeric(i)
assert x1 != x2
m = abs(y1 - y2) / abs(x1 - x2)
b = y1 - (m * x1)
new_y = m * new_x + b
return new_y

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.