diff --git a/qutebrowser/test/utils/test_utils.py b/qutebrowser/test/utils/test_utils.py index 6b8ad1553..296add4d7 100644 --- a/qutebrowser/test/utils/test_utils.py +++ b/qutebrowser/test/utils/test_utils.py @@ -75,41 +75,6 @@ class ReadFileTests(unittest.TestCase): self.assertEqual(content.splitlines()[0], "Hello World!") -class DottedGetattrTests(unittest.TestCase): - - """Test dotted_getattr. - - Attributes: - test: Test class instance for getattr. - """ - - class Test: - - """Sample class used to test dotted_getattr.""" - - foo = None - - class Test2: - - """Sample class used to test dotted_getattr.""" - - bar = 1 - - def setUp(self): - self.test = self.Test() - self.test.foo = self.Test2() - - def test_dotted_getattr(self): - """Test dotted_getattr with a valid path.""" - attr = utils.dotted_getattr(self, 'test.foo.bar') - self.assertEqual(attr, 1) - - def test_invalid_path(self): - """Test dotted_getattr with an invalid path.""" - with self.assertRaises(AttributeError): - _ = utils.dotted_getattr(self, 'test.foo.baz') - - class InterpolateColorTests(unittest.TestCase): """Tests for interpolate_color. diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 1dd13ee77..c37365bd9 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -85,19 +85,6 @@ def read_file(filename): return data.decode('UTF-8') -def dotted_getattr(obj, path): - """getattr supporting the dot notation. - - Args: - obj: The object where to start. - path: A dotted object path as a string. - - Return: - The object at path. - """ - return functools.reduce(getattr, path.split('.'), obj) - - def pastebin(name, title, text, parent=None): """Paste the text into a pastebin and return the URL.