def testFruitNullValue(self):
        # Since 'apple' is nullable, validate we can create an apple with the 'null' value.
        fruit = apple.Apple(None)
        self.assertIsNone(fruit)

        # 'banana' is not nullable.
        with self.assertRaises(petstore_api.ApiTypeError):
            banana.Banana(None)

        # Since 'fruit' has oneOf 'apple', 'banana' and 'apple' is nullable,
        # validate we can create a fruit with the 'null' value.
        fruit = Fruit(None)
        self.assertIsNone(fruit)

        # Redo the same thing, this time passing a null Apple to the Fruit constructor.
        fruit = Fruit(apple.Apple(None))
        self.assertIsNone(fruit)
    def testFruitNullValue(self):
        # Since 'apple' is nullable, validate we can create an apple with the 'null' value.
        fruit = apple.Apple(None)
        assert isinstance(fruit, Singleton)
        assert isinstance(fruit, apple.Apple)
        assert fruit.is_none() is True

        # 'banana' is not nullable.
        # TODO cast this into ApiTypeError?
        with self.assertRaises(TypeError):
            banana.Banana(None)

        # Since 'fruit' has oneOf 'apple', 'banana' and 'apple' is nullable,
        # validate we can create a fruit with the 'null' value.
        fruit = Fruit(None)
        assert isinstance(fruit, Singleton)
        assert isinstance(fruit, apple.Apple)
        assert isinstance(fruit, Fruit)
        assert fruit.is_none() is True