codekingpro/portable-devtools
114k
1import unittest2 3from .util import MemorySetup, Traversable4 5 6class TestMemoryTraversableImplementation(unittest.TestCase):7 def test_concrete_methods_are_not_overridden(self):8 """`MemoryTraversable` must not override `Traversable` concrete methods.9 10 This test is not an attempt to enforce a particular `Traversable` protocol;11 it merely catches changes in the `Traversable` abstract/concrete methods12 that have not been mirrored in the `MemoryTraversable` subclass.13 """14 15 traversable_concrete_methods = {16 method17 for method, value in Traversable.__dict__.items()18 if callable(value) and method not in Traversable.__abstractmethods__19 }20 memory_traversable_concrete_methods = {21 method22 for method, value in MemorySetup.MemoryTraversable.__dict__.items()23 if callable(value) and not method.startswith("__")24 }25 overridden_methods = (26 memory_traversable_concrete_methods & traversable_concrete_methods27 )28 29 assert not overridden_methods30 