Old:
def my_method(this, method, takes, a, bunch,
of, parameters):
New:
def my_method(this, method, now, takes,
a, bunch, of, different, parameters):
~good test~
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?
| import React, { Component } from 'react'; | |
| class PhotoInput extends Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| fileData: '', | |
| } |
| class MovieTypeaheadNode { | |
| constructor(parent, value) { | |
| this.value = value; | |
| this.parent = parent; | |
| this.children = []; | |
| this.matchingMovies = []; | |
| } | |
| addChild(letter) { | |
| let child = this.childWithValue(letter); |
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.
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Blank HTML5</title> | |
| <style> | |
| </style> | |
| </head> | |
| <body> |
| # 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 = "!" |
| // 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', |