Skip to content Skip to sidebar Skip to footer
Showing posts with the label Mocking

Really Weird... Can't Set Attributes Of Built-in/extension Type 'lxml.etree._element'

I've changed attributes for other classes before without issues. _Element is obviously not a bu… Read more Really Weird... Can't Set Attributes Of Built-in/extension Type 'lxml.etree._element'

Mock A Pyqt Method

I have an existing class which inherits from the PyQT5 classes QWidget and Ui_Dialog. I want to use… Read more Mock A Pyqt Method

How Do I Test An Api Client With Python?

I'm working on a client library for a popular API. Currently, all of my unit tests of said clie… Read more How Do I Test An Api Client With Python?

How To Patch The Python 3 Breakpoint() Builtin?

I wrote a decorator that halts my program with breakpoint() if a critical error happens. def the_br… Read more How To Patch The Python 3 Breakpoint() Builtin?

Mocking Instance Attributes

Please help me understand why the following doesn't work. In particular - instance attributes o… Read more Mocking Instance Attributes

Python Propertymock Side Effect With Attributeerror And Valueerror

I am trying to mock a property of a class (@property decorator) and have bumped into this incorrect… Read more Python Propertymock Side Effect With Attributeerror And Valueerror

Isinstance And Mocking

class HelloWorld(object): def say_it(self): return 'Hello I am Hello World' de… Read more Isinstance And Mocking

Adding Mock Objects In Python

My code under test does sth like this: def to_be_tested(x): return round((x.a + x.b).c()) I woul… Read more Adding Mock Objects In Python