Esempio n. 1
0
    def test_factory_being_called_if_item_missing(self):
        target = conf_factory.DefaultCache(factory_test, foo="bar")

        actual = target["eek"]
        assert actual == "Factory[eek]"
        assert "eek" in target
        assert target["eek"] == actual
    def test_factory_being_called_if_item_missing(self):
        target = conf_factory.DefaultCache(factory_test, foo='bar')

        actual = target['eek']
        assert actual == 'Factory[eek]'
        assert 'eek' in target
        assert target['eek'] == actual
Esempio n. 3
0
    def test_key_error_when_no_factory(self):
        target = conf_factory.DefaultCache()

        with pytest.raises(KeyError):
            target["foo"]

        assert "foo" not in target
Esempio n. 4
0
    def test_factory_not_called_if_item_exists(self):
        target = conf_factory.DefaultCache(factory_test, foo="bar")

        actual = target["foo"]
        assert actual == "bar"
        assert "foo" in target
    def test_factory_not_called_if_item_exists(self):
        target = conf_factory.DefaultCache(factory_test, foo='bar')

        actual = target['foo']
        assert actual == 'bar'
        assert 'foo' in target