because there's so much more than "get"
Is your method retrieving a record(s) from a data source? (e.g., a database or external service, or making a GET request)
get_*
fetch_*
Is your method creating a new record in a data source?
// script forked from https://gist.github.com/jamesramsay/9298cf3f4ac584a3dc05 | |
// to start timed execution: select "Install" from the menu above and hit "run" | |
// to stop timed execution: select "Uninstall" from the menu above and hit "run" | |
// to initialize a batch run ad-hoc and immediately: select "_processNextBatch" from the menu above and hit "run" | |
// runbook: | |
// - namespace labels like ee- | |
// - name labels like ee-archive-after-8d, ee-delete-after-45d | |
// - you can give a message more than one label (e.g., ee-archive-after-1d, ee-delete-after-5d) |
// script forked from https://gist.github.com/jamesramsay/9298cf3f4ac584a3dc05 | |
// to start timed execution: select "Install" from the menu above and hit "run" | |
// to stop timed execution: select "Uninstall" from the menu above and hit "run" | |
// to initialize a batch run ad-hoc and immediately: select "_processNextBatch" from the menu above and hit "run" | |
const LABELS_TO_DELETE = [ | |
// ... list of labels ... | |
// 'test-delete-after-label', | |
'spammy-alerts', | |
// 'delete-after-30d', |
# sourced from https://pastebin.com/12UpbQHT | |
import discord | |
from discord.ext import tasks, commands | |
from datetime import datetime, timedelta | |
bot_token = "some-bot-token" | |
# replace with your channel ID | |
channel_id = 1111 | |
bot_prefix = "!" |
// Tired of getting Meetup.com notifications? Me too. | |
// 1. Navigate to: http://www.meetup.com/account/comm/ (you must be logged in!) | |
// 2. Open your browser's console, and paste in the script below: | |
$('.commSettings').each(function(idx, item) {var $item = $(item);var boardId = $item.attr("id").split('_')[1];var url = $item.children('form').attr('action');var params = {evRemind:1,mailing_list_status:0, submitButton:'Save Settings', submit:'submit'};params['board_' + boardId] = boardId;$.ajax({data: params, url: url, type: 'post'});});$('.generalEmailSettings').find('input[type="checkbox"]').prop('checked', false);$('.generalEmailSettings').find('input[type="submit"]').click(); |
because there's so much more than "get"
Is your method retrieving a record(s) from a data source? (e.g., a database or external service, or making a GET request)
get_*
fetch_*
Is your method creating a new record in a data source?
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Blank HTML5</title> | |
<style> | |
</style> | |
</head> | |
<body> |
~good test~
mock.Mock()
is great. It's the reason that I use Python for small side projects - it makes unit testing a breeze. But over-reliance on mock objects for testing can obscure the meaning of your test (at best), and (at worst) it can create bugs in your test code.
spec_set
when creating object fakes.autospec=True
when stubbing method functionality.Similar to mock.Mock()
, Pytest fixtures (functions defined with the decorator @pytest.fixture()
) can be super handy for writing unit tests, but if they are overused, they can obscure the meaning of what you're testing.
class MovieTypeaheadNode { | |
constructor(parent, value) { | |
this.value = value; | |
this.parent = parent; | |
this.children = []; | |
this.matchingMovies = []; | |
} | |
addChild(letter) { | |
let child = this.childWithValue(letter); |