Skip to content

Instantly share code, notes, and snippets.

View fisher6's full-sized avatar
🥑

Gal Fisher fisher6

🥑
  • DC
  • 09:32 (UTC -04:00)
View GitHub Profile
@fisher6
fisher6 / jest--watch.js
Created December 17, 2019 18:42
Intacct failed tests
PASS tests/xometry/order.test.js
PASS tests/event_handlers/customer_advance.test.js
PASS tests/event_handlers/create_sales_order.test.js
FAIL tests/event_handlers/create_sales_invoice.test.js
● createSalesInvoice › when everything needs to be invoiced
expect(received).toMatchSnapshot(hint)
Snapshot name: `createSalesInvoice when everything needs to be invoiced: xml for creating sales invoice 1`
"""
If a sticker is the collection of
the letters of "givecampusinc", return the
number of stickers needed to complete an input
string. "mice span" would require one sticker,
"give mice span" would require 2 because
the 2nd 'e' requires a new sticker. Treat it as case-insensitive.
"""
def how_many_sticks(sticker, letters_input):
# implemention for (each) loop in python as a function.
# Example:
# forr([1,2,3], print)
# is the same as
# for item in container:
# print(item)
def forr(cont, func):
""" forr(cont, func) == for x in cont: func(x) """
@fisher6
fisher6 / mock_tut.py
Created July 24, 2017 14:18
Python mocking example
from mock import Mock, MagicMock
mock = Mock(return_value=1)
mock(1, 5, animal='dog') # returns 1 always
m = MagicMock(side_effect=ValueError)
m(1, 2, 3, 4) # raises valueError
m = Mock()
attrs = {'mocked_method.return_value': 3,