This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <ctime> | |
#include <msgpack.hpp> | |
struct message | |
{ | |
std::string tag; | |
std::time_t time; | |
std::string text; | |
MSGPACK_DEFINE(tag, time, text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import time | |
from collections import OrderedDict | |
class Cache(): | |
""" | |
In process memory cache. Not thread safe. | |
Usage: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Example code to show how it is possible to mock an entire module by patching | |
the sys.modules dict using mock ( http://www.voidspace.org.uk/python/mock/ ). | |
''' | |
from mock import patch, MagicMock | |
def test_import_patching(): | |
module_mock = MagicMock() | |
with patch.dict('sys.modules', **{ |