MCPcopy
hub / github.com/scrapy/scrapy / test_weakref_slots

Method test_weakref_slots

tests/test_selector.py:94–100  ·  view source on GitHub ↗

Check that classes are using slots and are weak-referenceable

(self)

Source from the content-addressed store, hash-verified

92 Selector(r1).xpath("//text()").getall()
93
94 def test_weakref_slots(self):
95 """Check that classes are using slots and are weak-referenceable"""
96 x = Selector(text="")
97 weakref.ref(x)
98 assert not hasattr(x, "__dict__"), (
99 f"{x.__class__.__name__} does not use __slots__"
100 )
101
102 def test_selector_bad_args(self):
103 with pytest.raises(ValueError, match="received both response and text"):

Callers

nothing calls this directly

Calls 1

SelectorClass · 0.90

Tested by

no test coverage detected