diff options
author | Leonard Richardson <leonardr@segfault.org> | 2021-10-11 14:42:01 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2021-10-11 14:42:01 -0400 |
commit | 242a340e5cf8c13449c9a4d73cf55194536a27d1 (patch) | |
tree | fc839d9825dd2f2bf3782baf1ec6a4ee6c178f75 /bs4/tests/test_navigablestring.py | |
parent | cf371d4ab99860d96b97b355d5c01a45013f9c42 (diff) |
More test refactoring.
Diffstat (limited to 'bs4/tests/test_navigablestring.py')
-rw-r--r-- | bs4/tests/test_navigablestring.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bs4/tests/test_navigablestring.py b/bs4/tests/test_navigablestring.py index 37cb86a..2b76392 100644 --- a/bs4/tests/test_navigablestring.py +++ b/bs4/tests/test_navigablestring.py @@ -1,3 +1,5 @@ +import pytest + from bs4.element import ( CData, Comment, @@ -43,7 +45,14 @@ class TestNavigableString(SoupTest): # Unless you specifically say that comments are okay. assert "foe" == comment.get_text(strip=True, types=Comment) assert "foe " == comment.get_text(types=(Comment, NavigableString)) - + + def test_string_has_immutable_name_property(self): + # string.name is defined as None and can't be modified + string = self.soup("s").string + assert None == string.name + with pytest.raises(AttributeError): + string.name = 'foo' + class TestNavigableStringSubclasses(SoupTest): def test_cdata(self): |