Skip to main content

All Questions

Tagged with
-1 votes
1 answer
50 views

Need help testing this function using pytest . I try to test is but with every test it keeps altering my csv file . how can i bypass some variables? [duplicate]

This is the function I'm trying to test: def withdraw(): while 1: try: wd = float(input("How much $ would you like to withdraw? :")) break except ...
Carlos Fernandes's user avatar
0 votes
1 answer
39 views

How do I return the function name of a class method being passed in as an argument?

I have a class called bio_seq with a class method called transcribe() and I am doing an exercise to create my own unit tests. I have created a function called unitTest() such as below so I have a ...
Chephen's user avatar
0 votes
0 answers
80 views

Python Doctest Syntax requiring blanks after? blanks already included

I am trying to run a Doctest which is returning the following Syntax related error when running Python -m doctest ValueError: line 4 of the docstring for app.check_valid_curr lacks blank after >&...
Sean.realitytester's user avatar
1 vote
1 answer
430 views

Test class methods using Pytest

I am taking a programming course now, CSE 111 programming with functions, and my last assignment is to find an interesting code and write some test functions, to test the correct working of the code. ...
Nelson Petro's user avatar
0 votes
0 answers
64 views

Exception has occurred: ModuleNotFoundError No module named 'mainfunction'

project/tests/tests_app.py from mainfunction import * class TestApp: def test_kali(self, numbers): res = dikalikan_dua(numbers[0]) assert res == numbers[1] def test_bagi(self,...
Zakymuhammadyusuf's user avatar
0 votes
1 answer
87 views

find and call any function by function in string

It is tricky question, I need to know one thing that... two function with different functionality and one more function called 3rd function which will decide that to use any one function. That ...
hungry_in_learning's user avatar
0 votes
1 answer
41 views

Testing Functions for Program

I have a task where I need to create a series of functions that will test a program given to us. The only tests I need to provide are ones that will come out to True I followed an example and tried to ...
Hypnotix999's user avatar
0 votes
1 answer
28 views

find a file with specific extension anywhere in the system

I need to code a test for a function I have defined in Python 3.9. As the funtion is supposed to receive a file of a specific extension and its path, and then load it in Python, my test should look ...
ZahraonStack's user avatar
0 votes
0 answers
146 views

Python test - Ran 0 tests in 0.000s

I created the following test function for a python script. class Test(unittest.TestCase): def test_log_model(self): response = requests.post( url='http://127.0.0.1:5000/...
Amanda's user avatar
  • 17
0 votes
3 answers
273 views

Python function that searches through three lists of strings for an element

I need to write a function that takes three dishes and a specified ingredient and outputs true if all the dishes are free from that ingredient and false if ANY of them contain it. The inputs are the ...
Holly Rose's user avatar
2 votes
2 answers
2k views

Can I test a function defined in a file manually in the terminal in vscode?

I have previously only written python code using IDLE but since I am starting to do some more "heavier" programming I figured I should start using Visual Studio Code. I am however having ...
Simite's user avatar
  • 21
1 vote
2 answers
183 views

Need help trying to test function to find area of rectangle using co-ordinates

I have a Rectangle class that finds the area of a Rectangle using top-left and bottom-right coordinates. I'm having trouble writing up a test function to test the code and verify it works. class ...
Strewth's user avatar
  • 15
0 votes
1 answer
52 views

Testing python function all types

Hi everyone I'm beginner in python and I want to test my function. But I got errors. And can I use true or false statement here too. def create(name1, name2, ext='.jpg'): if name2: ...
user avatar
0 votes
2 answers
70 views

How can I write a test for this python function?

How can I write pytest for this function using python. def func(name): return 'first' in name or 'second' in name
 Mandarin's user avatar
2 votes
1 answer
2k views

How to Parameterize Test Function: Pytest?

How do I pass a list of data, to a Test Function using Pytest? Each Test Case is pretty similar, except for this input parameter. I have tried the following but to no avail: import pytest @pytest....
A B's user avatar
  • 29

15 30 50 per page