Exemplo n.º 1
0
 def test_cached_attrs_expiry(self):
     """_cached_attrs should expire when _match_cache is updated."""
     c = Cell('\n!v', True)
     # Fill _match_cache and _attrs_match_cache
     self.assertEqual(c.attrs, {})
     # Invalidate both caches
     c.insert(2, 'a|')
     # Update _match_cache
     self.assertEqual(c.value, 'v')
     # _attrs_match_cache should not be valid
     self.assertEqual(c.attrs, {'a': ''})
Exemplo n.º 2
0
def test_cached_attrs_expiry():
    """_cached_attrs should expire when _match_cache is updated."""
    c = Cell('\n!v', True)
    # Fill _match_cache and _attrs_match_cache
    assert c.attrs == {}
    # Invalidate both caches
    c.insert(2, 'a|')
    # Update _match_cache
    assert c.value == 'v'
    # _attrs_match_cache should not be valid
    assert c.attrs == {'a': ''}