Skip to main content

All Questions

Tagged with
3 votes
1 answer
565 views

Python testing assertions (unittest, playwright)

so im new to testing and have been learning python/playwright testing for a couple of weeks now. I've got to assertions and have found multiple ways to write them, so this might sound like a stupid ...
Aleksandar Dostinov's user avatar
0 votes
1 answer
204 views

Python FAILED AssertionError with GitHub Actions CI / CD Pipeline with AWS

I am trying to reproduce, step-by-step, the instructions on this video "Cloud Resume Challenge Sprint (Sept, 2022) - Week 4" from youtube, https://youtu.be/wiyI0Ngn31o, on how to setup ...
Justin Henson's user avatar
0 votes
1 answer
91 views

Assert tests in python [duplicate]

I am suppose to assert my code function to make sure they are running smoothly but I am not sure how I should go about this. The function itself makes a widget disappears and the reappears if the user ...
coding101's user avatar
0 votes
1 answer
41 views

python assert total_area < 500 test

Im trying to use an assert to check if the total area of a polygon is more than 500 ha. But when I use data that is more than 500 it still passes the test. geom = feature['geometry']['coordinates']...
Where_am_I's user avatar
1 vote
1 answer
744 views

Why is Python assertEqual telling me I'm missing the second argument in this unittest?

I'm currently testing the construction of some objects in Python, and I simply can't get past this infuriating error. Here is my code: from unittest import TestCase class TestEquals(TestCase): ...
Joakim Houmøller'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
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
-1 votes
1 answer
59 views

Test python function

Good morning! I need to create a test for a python function. The result to be tested is a very large dataframe in json format. What can I put in assert to test that the json file has been created ...
Amanda's user avatar
  • 17
1 vote
1 answer
679 views

How do you interpret an assert statement if it contains an 'if .... else ....'?

EDIT: its answered, I did not understand what a ternary operator is. For people from the future that have the similar question: https://book.pythontips.com/en/latest/ternary_operators.html I'm ...
bananenheld's user avatar
0 votes
2 answers
271 views

Assertion error testing attributes and methods in a class

For the sake of practice, I am writing a class BankAccount to learn OOP in python. In an attempt to make my program more redundant am trying to write a test function test_BankBankAccount() to practice ...
fredericoamigo's user avatar
0 votes
2 answers
966 views

How can I mock multiple prints?

I have this function: def function1(): number1 = int(input()) number2 = int(input()) print("Calculate sum") sum = number1 + number2 print("Calculate product") ...
AdryL's user avatar
  • 33
0 votes
1 answer
44 views

I have a different opinion about my usage of the Python assert statement and I would like you to tell me why I am wrong

Please hear me out. I know how assert works. For context, some of the applications and usages I have in mind involve mathematical optimization through a GUI, so the functions can be called hundreds ...
Ia Nick's user avatar
  • 11
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
2 answers
1k views

assertEqual two dicts except one key

I need to test a function which will return an dict with rest_framework.test.APITestCase's assertEqual in django. The dict is something like this: { "first_name": "John", "last_name": "Doe", ...
Ghasem's user avatar
  • 15.3k
0 votes
2 answers
152 views

How to check if the text field conains inputed per defined text in Python Selenium Webdriver

I tried to use some assert statements but it everytime fails. button_test1 = driver.find_elements_by_xpath('//*[@class="custom-select"]')[0] button_test1.click() time.sleep(2) button_test2 = driver....
Luke Teensie's user avatar

15 30 50 per page