<commit_before>import json
from . import Person
from .. import MedeaCamelMapper, MedeaEncoder, register_mapper, medea


class Pet(object):
    pass

register_mapper(Pet, MedeaCamelMapper('name', 'kind'))


class Dog(Pet):
    def __init__(self, name):
        self.name = name
        self.kind = 'Dog'


class Cat(Pet):
    def __init__(self, name):
        self.name = name
        self.kind = 'Cat'


class PetPerson(Person):
    pass

register_mapper(PetPerson, MedeaCamelMapper('first_name', 'last_name', 'pets'))


def test_medea_mapper():
    anne = PetPerson('Anne', 'Frank')
    assert medea(anne) == {
        'firstName': 'Anne',
        'lastName': 'Frank'}

    fido = Dog('Fido')
    assert medea(fido) == {
        'kind': 'Dog', 'name': 'Fido'}

    spot = Dog('Spot')
    assert medea(spot) == {
        'kind': 'Dog', 'name': 'Spot'}

    garfield = Cat('Garfield')
    assert medea(garfield) == {
        'kind': 'Cat', 'name': 'Garfield'}

    anne.pets = [fido, spot, garfield]
    print medea(anne)
    assert medea(anne) == {
        'firstName': 'Anne',
        'lastName': 'Frank',
        'pets': [
            {'kind': 'Dog', 'name': 'Fido'},
            {'kind': 'Dog', 'name': 'Spot'},<commit_msg>remove print debug statment<commit_after>import json
from . import Person
from .. import MedeaCamelMapper, MedeaEncoder, register_mapper, medea


class Pet(object):
    pass

register_mapper(Pet, MedeaCamelMapper('name', 'kind'))


class Dog(Pet):
    def __init__(self, name):
        self.name = name
        self.kind = 'Dog'


class Cat(Pet):
    def __init__(self, name):
        self.name = name
        self.kind = 'Cat'


class PetPerson(Person):
    pass

register_mapper(PetPerson, MedeaCamelMapper('first_name', 'last_name', 'pets'))


def test_medea_mapper():
    anne = PetPerson('Anne', 'Frank')
    assert medea(anne) == {
        'firstName': 'Anne',
        'lastName': 'Frank'}

    fido = Dog('Fido')
    assert medea(fido) == {
        'kind': 'Dog', 'name': 'Fido'}

    spot = Dog('Spot')
    assert medea(spot) == {
        'kind': 'Dog', 'name': 'Spot'}

    garfield = Cat('Garfield')
    assert medea(garfield) == {
        'kind': 'Cat', 'name': 'Garfield'}

    anne.pets = [fido, spot, garfield]
    assert medea(anne) == {
        'firstName': 'Anne',
        'lastName': 'Frank',
        'pets': [
            {'kind': 'Dog', 'name': 'Fido'},
            {'kind': 'Dog', 'name': 'Spot'},
{'fraction_non_alphanumeric': 0.1751227495908347, 'fraction_numerical': 0.0, 'mean_word_length': 2.796583850931677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7559859', 'n_tokens_mistral': 881, 'n_tokens_neox': 826, 'n_words': 196}