diff --git a/tests/parser/test_ancestor_navigation.py b/tests/parser/test_ancestor_navigation.py
new file mode 100644
index 0000000..1814ec5
--- /dev/null
+++ b/tests/parser/test_ancestor_navigation.py
@@ -0,0 +1,66 @@
+"""
+Tests for Selector.iterancestors() and Selector.find_ancestor() methods.
+Target file: tests/parser/test_general.py (append to TestElementNavigation class)
+"""
+import pytest
+from scrapling import Selector
+
+
+@pytest.fixture
+def nested_page():
+ html = """
+
+ elements"
+ assert len(similar) == 2 # Banana and Carrot, not Grape (section)
+
+ def test_find_similar_high_threshold_filters_more(self, product_page):
+ """A higher similarity_threshold should return fewer (or equal) results"""
+ first = product_page.css("div.product")[0]
+ low_threshold = first.find_similar(similarity_threshold=0.1)
+ high_threshold = first.find_similar(similarity_threshold=0.9)
+ assert len(high_threshold) <= len(low_threshold)
+
+ def test_find_similar_match_text_excludes_different_text(self, product_page):
+ """match_text=True should factor in text content during similarity scoring"""
+ first = product_page.css("div.product")[0] # Apple
+ # With match_text=True and a high threshold, "Apple" vs "Banana"/"Carrot" text
+ # should reduce similarity scores — result count may drop
+ with_text = first.find_similar(similarity_threshold=0.8, match_text=True)
+ without_text = first.find_similar(similarity_threshold=0.8, match_text=False)
+ # match_text=True is stricter when text differs, so result should be <= without_text
+ assert len(with_text) <= len(without_text)
+
+ def test_find_similar_ignore_attributes_affects_matching(self, product_page):
+ """Ignoring data-price should make more elements qualify as similar"""
+ first = product_page.css("div.product")[0]
+ # Ignore both data-price and data-category → only class matters → all 3 divs match
+ ignore_all_data = first.find_similar(
+ similarity_threshold=0.2,
+ ignore_attributes=["data-price", "data-category"]
+ )
+ # Ignore nothing → data-category difference (fruit vs veggie) may reduce matches
+ ignore_nothing = first.find_similar(
+ similarity_threshold=0.9,
+ ignore_attributes=[]
+ )
+ assert len(ignore_all_data) >= len(ignore_nothing)
+
+ def test_find_similar_on_text_node_returns_empty(self, product_page):
+ """find_similar() on a text node should return empty Selectors without raising"""
+ text_node = product_page.css(".name::text")[0]
+ result = text_node.find_similar()
+ assert len(result) == 0
diff --git a/tests/parser/test_selectors_filter.py b/tests/parser/test_selectors_filter.py
new file mode 100644
index 0000000..9612abc
--- /dev/null
+++ b/tests/parser/test_selectors_filter.py
@@ -0,0 +1,64 @@
+"""
+Tests for Selectors.filter() method edge cases.
+Target file: tests/parser/test_parser_advanced.py (append to TestAdvancedSelectors class)
+"""
+import pytest
+from scrapling import Selector, Selectors
+
+
+@pytest.fixture
+def page():
+ html = """
+
+
+ - Apple
+ - Banana
+ - Cherry
+ - Durian
+
+
+ """
+ return Selector(html, adaptive=False)
+
+
+class TestSelectorsFilter:
+ def test_filter_basic(self, page):
+ """filter() should return only elements matching the predicate"""
+ items = page.css("li.item")
+ expensive = items.filter(lambda el: int(el.attrib.get("data-value", 0)) >= 10)
+ assert len(expensive) == 2
+ texts = expensive.getall()
+ assert any("Apple" in t for t in texts)
+ assert any("Cherry" in t for t in texts)
+
+ def test_filter_returns_empty_selectors_when_no_match(self, page):
+ """filter() should return an empty Selectors (not None/exception) when nothing matches"""
+ items = page.css("li.item")
+ result = items.filter(lambda el: int(el.attrib.get("data-value", 0)) > 9999)
+ assert isinstance(result, Selectors)
+ assert len(result) == 0
+ assert result.first is None
+
+ def test_filter_all_pass(self, page):
+ """filter() with always-True predicate should return all elements"""
+ items = page.css("li.item")
+ result = items.filter(lambda el: True)
+ assert len(result) == len(items)
+
+ def test_filter_chained(self, page):
+ """filter() should be chainable — apply two filters in sequence"""
+ items = page.css("li.item")
+ # First: value > 0, then: not disabled
+ result = (
+ items
+ .filter(lambda el: int(el.attrib.get("data-value", 0)) > 0)
+ .filter(lambda el: not el.has_class("disabled"))
+ )
+ assert len(result) == 3 # Apple, Banana, Cherry (Durian is disabled AND value=0)
+
+ def test_filter_on_empty_selectors(self):
+ """filter() on an already-empty Selectors should not raise"""
+ empty = Selectors()
+ result = empty.filter(lambda el: True)
+ assert isinstance(result, Selectors)
+ assert len(result) == 0