Skip to content

Instantly share code, notes, and snippets.

View belyak's full-sized avatar

Andrey Belyak belyak

  • Russian Federation, Saint-Petersburg
View GitHub Profile
#!/usr/bin/env python3
import itertools
import math
import os
import unittest
from typing import List, Optional
import yaml
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOHPdA4eFaXbwl8A7HPNXZTeHQJ701yvtxKNcAOvR1ICJP0Fx7xXXHieXh58Nr35hI/fyFqKEFHIT3IAcQgvinJ55cBEGcLCr5OhWsQfiwlvYHaX818zhZnKWZVvG1mDz5JMmGWa8XKDMGJynwZJ0vacAukvcREGnU/yVdnVGFLbmRrjCGMhZVS5HFuVkBcBw9XYOtEtE1vRLCcr+Wa9SKKe0lmKln8mlxkZHbWQLfMmauc9NPEHe32SBccAHL3dfLTGN2Bf7igJgRc4qpi4dqIxwVPFPu39TJSBnpOxRvjK+xdtfWm0MBVdu+5gZvg24Bv/SsT3wZBAOSH0eYdKvv andy@andy-Inspiron-3721
@belyak
belyak / test_complex_function.py
Created January 6, 2018 01:25
Patching many functions for all test case methods
from unittest import TestCase
from unittest.mock import patch, call
from my_project.module import complex_function
class SomeTestCase(TestCase):
# in this test case every method will mock calls to func_1, func_2, func_3, func_4
def setUp(self):
super().setUp()
@belyak
belyak / reverseadmin.py
Created October 29, 2015 13:49 — forked from wolever/reverseadmin.py
Forked from https://gist.github.com/mzbyszewska/8b6afc312b024832aa85 , updated to work with Django 1.8
'''
adminreverse from here http://djangosnippets.org/snippets/2032/
changed for working with ForeignKeys
'''
'''
reverseadmin
============
Module that makes django admin handle OneToOneFields in a better way.
A common use case for one-to-one relationships is to "embed" a model
inside another one. For example, a Person may have multiple foreign