from unittest import TestCase

from marshmallow_polyfield.polyfield import PolyFieldBase


class TestPolyFieldBase(TestCase):
    def run_test(self):
        with self.assertRaises(NotImplementedError):
            PolyFieldBase.serialization_schema_selector(None, None, None)

        with self.assertRaises(NotImplementedError):
            PolyFieldBase.deserialization_schema_selector(None, None, None)

from marshmallow_polyfield.polyfield import PolyFieldBase


class TrivialExample(PolyFieldBase):
    def serialization_schema_selector(self, value, obj):
        super(TrivialExample, self).serialization_schema_selector(value, obj)

    def deserialization_schema_selector(self, value, obj):
        super(TrivialExample, self).deserialization_schema_selector(value, obj)


def test_polyfield_base():
    te = TrivialExample()
    try:
        te.serialization_schema_selector(None, None)
    except NotImplementedError:
        pass
    else:
        assert False, 'expected to raise'

    try:
        te.deserialization_schema_selector(None, None)
    except NotImplementedError:
        pass
    else:
        assert False, 'expected to raise'

fix test so it gets run