From 311b9f20340d4de195ca3bbd0957d7284426ffde Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 4 Jun 2014 07:16:02 +0200 Subject: [PATCH] Get rid of FakeDict --- .../test/utils/usertypes/test_fakedict.py | 55 ------------------- qutebrowser/utils/completer.py | 1 - qutebrowser/utils/usertypes.py | 18 ------ 3 files changed, 74 deletions(-) delete mode 100644 qutebrowser/test/utils/usertypes/test_fakedict.py diff --git a/qutebrowser/test/utils/usertypes/test_fakedict.py b/qutebrowser/test/utils/usertypes/test_fakedict.py deleted file mode 100644 index 7634272bc..000000000 --- a/qutebrowser/test/utils/usertypes/test_fakedict.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2014 Florian Bruhin (The Compiler) -# -# This file is part of qutebrowser. -# -# qutebrowser is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# qutebrowser is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with qutebrowser. If not, see . - -# pylint: disable=missing-docstring - -"""Tests for the FakeDict class.""" - -import unittest -from unittest import TestCase - -from qutebrowser.utils.usertypes import FakeDict - - -class FakeDictTests(TestCase): - - """Test the FakeDict usertype. - - Attributes: - fd: The FakeDict we're testing. - """ - - def setUp(self): - self.fd = FakeDict("foo") - - def test_getitem(self): - """Test getting items of the fakedict.""" - self.assertEqual(self.fd["eggs"], "foo") - self.assertEqual(self.fd["bacon"], "foo") - - def test_setitem(self): - """Test setting items of the FakeDict which should raise TypeError.""" - with self.assertRaises(TypeError): - self.fd["eggs"] = "bar" - - def test_repr(self): - """Test repr() on the FakeDict.""" - self.assertEqual(repr(self.fd), "FakeDict('foo')") - - -if __name__ == '__main__': - unittest.main() diff --git a/qutebrowser/utils/completer.py b/qutebrowser/utils/completer.py index d84f02b99..552289d62 100644 --- a/qutebrowser/utils/completer.py +++ b/qutebrowser/utils/completer.py @@ -28,7 +28,6 @@ from qutebrowser.models.completion import ( CommandCompletionModel, SettingSectionCompletionModel, SettingOptionCompletionModel, SettingValueCompletionModel) from qutebrowser.models.basecompletion import NoCompletionsError -from qutebrowser.utils.usertypes import FakeDict class Completer(QObject): diff --git a/qutebrowser/utils/usertypes.py b/qutebrowser/utils/usertypes.py index 53972bafe..56090db50 100644 --- a/qutebrowser/utils/usertypes.py +++ b/qutebrowser/utils/usertypes.py @@ -230,24 +230,6 @@ class NeighborList(collections.abc.Sequence): return self.curitem() -class FakeDict: - - """A fake dictionary which always returns the same value. - - Attributes: - _val: The value to return. - """ - - def __init__(self, val): - self._val = val - - def __getitem__(self, _key): - return self._val - - def __repr__(self): - return "FakeDict('{}')".format(self._val) - - # The mode of a Question. PromptMode = enum('yesno', 'text', 'user_pwd', 'alert')