diff options
author | Leonard Richardson <leonardr@segfault.org> | 2017-05-06 14:43:41 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2017-05-06 14:43:41 -0400 |
commit | a8a9224b7f97e882cc8ec712323d8b86631e42e9 (patch) | |
tree | c05a9ca701a2f0f5bccca4b75124e87193bc99b8 /bs4 | |
parent | db3b9cf9e69aec1e333c17e52fe6d7cf56c0bf2f (diff) | |
download | beautifulsoup4-a8a9224b7f97e882cc8ec712323d8b86631e42e9.tar.gz |
Renamed convenience method to get_attribute_text.
Diffstat (limited to 'bs4')
-rw-r--r-- | bs4/element.py | 2 | ||||
-rw-r--r-- | bs4/tests/test_tree.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/bs4/element.py b/bs4/element.py index 5462592..71cdb65 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -992,7 +992,7 @@ class Tag(PageElement): attribute.""" return self.attrs.get(key, default) - def string_attr(self, key, default=None): + def get_attribute_text(self, key, default=None): """The same as get(), but converts lists of values to strings.""" value = self.get(key, default) if isinstance(value, list): diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index f57255d..90a6d25 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -1288,7 +1288,7 @@ class TestCDAtaListAttributes(SoupTest): def test_attribute_values_joined_into_string_through_string_attr(self): soup = self.soup("<a class='foo\tbar'>") - self.assertEqual(b'foo bar', soup.a.string_attr('class')) + self.assertEqual('foo bar', soup.a.get_attribute_text('class')) def test_accept_charset(self): soup = self.soup('<form accept-charset="ISO-8859-1 UTF-8">') |