How to Use Mock in PyTest?

In unit tests, you would want to focus on the code you want to test and avoid dealing with external dependencies that your code might be using. Or, your program might have external dependencies that are not available at the time of the test. In these situations, you can use mocks in your tests. This … Read more

Python __and__() Magic Method

Syntax object.__and__(self, other) The Python __and__() method implements the built-in Bitwise AND & operation. So, when you cal x & y, Python attempts to call x.__and__(y). If the method is not implemented, Python first attempts to call __rand__ on the right operand and if this isn’t implemented either, it raises a TypeError. We call this … Read more

Earn Passive and Active Income ($200/h) as a Chainlink Validator and Freelance Consultant

Just stumbled upon this opportunity and freelancing niche that could be highly profitable in the Blockchain industry, fun, and sustainable for decades to come. Do you want to grab this opportunity? References from the video: Official website Chainlink: https://chain.link/ Run a Chainlink node: https://docs.chain.link/docs/running-a-chainlink-node/ The gap — nobody on Upwork offers their focused Chainlink services: … Read more

Python __rshift__() Magic Method

Syntax object.__rshift__(self, other) The Python __rshift__() method implements the built-in >> operation. So, when you cal x >> y, Python attempts to call x.__rshift__(y). If the method is not implemented, Python first attempts to call __rrshift__ on the right operand and if this isn’t implemented either, it raises a TypeError. We call this a “Dunder … Read more

Python __lshift__() Magic Method

Syntax object.__lshift__(self, other) The Python __lshift__() method implements the built-in << operation. So, when you cal x << y, Python attempts to call x.__lshift__(y). If the method is not implemented, Python first attempts to call __rlshift__ on the right operand and if this isn’t implemented either, it raises a TypeError. We call this a “Dunder … Read more

Self-Employed Programmer? A Simple Heuristic

Python Freelancer

Should you become your own boss, being self-employed? This is a valid question given the massive opportunities these days. Freelancing is growing double-digits percentages every year: One of the largest freelancing platforms Fiverr recently reported an 89% (!) annual growth rate! ?Β This article and video will help you decide if this opportunity is for you! … Read more

Python __pow__() Magic Method

Syntax object.__pow__(self, other) The Python __pow__() method implements the built-in exponentiation operation. So, when you call pow(a, b) or a ** b, Python attempts to call x.__pow__(y). If the method is not implemented, Python first attempts to call __rpow__ on the right operand and if this isn’t implemented either, it raises a TypeError. We call … Read more