from bidict import BidirectionalMapping


class DumbBidirectionalMapping(dict):
    def __inverted__(self):
        for (key, val) in self.items():
            yield (val, key)

    @property
    def inv(self):
        return DumbBidirectionalMapping(self.__inverted__())


def test_subclasshook():
    assert issubclass(DumbBidirectionalMapping, BidirectionalMapping)
    assert not issubclass(dict, BidirectionalMapping)

from bidict import BidirectionalMapping


class DumbBidirectionalMapping(dict):
    def __inverted__(self):
        for (key, val) in self.items():
            yield (val, key)

    @property
    def inv(self):
        return DumbBidirectionalMapping(self.__inverted__())


class OldstyleClass():
    """
    Old-style class (not derived from object).
    This used to crash due to missing __mro__ attribute that is not present
    in oldstyle classes.
    """


def test_subclasshook():
    assert issubclass(DumbBidirectionalMapping, BidirectionalMapping)
    assert not issubclass(dict, BidirectionalMapping)
    assert not issubclass(OldstyleClass, BidirectionalMapping)

Add test for oldstyle class handling
Add test for oldstyle class handling

  from bidict import BidirectionalMapping
  
  
  class DumbBidirectionalMapping(dict):
      def __inverted__(self):
          for (key, val) in self.items():
              yield (val, key)
  
      @property
      def inv(self):
          return DumbBidirectionalMapping(self.__inverted__())
  
  
+ class OldstyleClass():
+     """
+     Old-style class (not derived from object).
+     This used to crash due to missing __mro__ attribute that is not present
+     in oldstyle classes.
+     """
+ 
+ 
  def test_subclasshook():
      assert issubclass(DumbBidirectionalMapping, BidirectionalMapping)
      assert not issubclass(dict, BidirectionalMapping)
+     assert not issubclass(OldstyleClass, BidirectionalMapping)
  
Add test for oldstyle class handling
## Code Before:
from bidict import BidirectionalMapping


class DumbBidirectionalMapping(dict):
    def __inverted__(self):
        for (key, val) in self.items():
            yield (val, key)

    @property
    def inv(self):
        return DumbBidirectionalMapping(self.__inverted__())


def test_subclasshook():
    assert issubclass(DumbBidirectionalMapping, BidirectionalMapping)
    assert not issubclass(dict, BidirectionalMapping)

## Instruction:
Add test for oldstyle class handling
## Code After:
from bidict import BidirectionalMapping


class DumbBidirectionalMapping(dict):
    def __inverted__(self):
        for (key, val) in self.items():
            yield (val, key)

    @property
    def inv(self):
        return DumbBidirectionalMapping(self.__inverted__())


class OldstyleClass():
    """
    Old-style class (not derived from object).
    This used to crash due to missing __mro__ attribute that is not present
    in oldstyle classes.
    """


def test_subclasshook():
    assert issubclass(DumbBidirectionalMapping, BidirectionalMapping)
    assert not issubclass(dict, BidirectionalMapping)
    assert not issubclass(OldstyleClass, BidirectionalMapping)
