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'

Concept: Mocking Db Python

I'm working with postgresql and I have used MagicMock to test, but I'm not sure that I have… Read more Concept: Mocking Db Python

Mocking Instance Attributes

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

How To Permanently Mock Return Value Of A Function In Python Unittest

I have a function # foo.py NUM_SHARDS = 10 def get_shard(shard_key: int) -> int return (shar… Read more How To Permanently Mock Return Value Of A Function In Python Unittest

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?

Mocking A Socket Connection In Python

I am trying to write unit tests for a class in python. The class opens a tcp socket on init. I am t… Read more Mocking A Socket Connection In Python