<commit_before>import json
import os
import unittest

from .marvel import Marvel
from .character import CharacterDataWrapper, CharacterDataContainer, Character
from .comic import ComicDataWrapper, ComicDataContainer, Comic
from .config import *

class PyMarvelTestCase(unittest.TestCase):

    def setUp(self):
        self.m = Marvel(PUBLIC_KEY, PRIVATE_KEY)

    def tearDown(self):
        pass

    def test_get_character(self):
        cdw = self.m.get_character(1009718)

        assert cdw.code == 200
        assert cdw.status == 'Ok'
        assert cdw.data.results[0].name == "Wolverine"

    def test_get_character_get_comics(self):
        comic_dw = self.m.get_character(1009718).data.results[0].get_comics()

        assert comic_dw.code == 200
        assert comic_dw.status == 'Ok'
        
        print "Wolvy comics: \n"
        for c in comic_dw.data.results:
            print "%s - %s" % (c.id, c.title)

    def test_get_characters(self):
        cdw = self.m.get_characters(orderBy="name,-modified", limit="10", offset="15")

        assert cdw.code == 200
        assert cdw.status == 'Ok'

        assert cdw.data.count > 0
        assert cdw.data.offset == 15
        assert cdw.data.limit == 10
        assert len(cdw.data.results) > 0

        assert type(cdw) is CharacterDataWrapper
        assert type(cdw.data) is CharacterDataContainer
        assert type(cdw.data.results) is list

        for c in cdw.data.results:
            print "%s - %s" % (c.id, c.name)

    def test_get_characters_next(self):
        cdw = self.m.get_characters(orderBy="name,-modified", limit="20", offset="15")
        new_cdw = cdw.next()

        assert new_cdw.code == 200

        #poor test?
        assert new_cdw.data.offset == cdw.data.offset + cdw.data.limit


    def test_get_comic(self):
        cdw = self.m.get_comic(41530)

        assert cdw.code == 200
        assert cdw.status == 'Ok'

        assert cdw.data.count > 0
        assert cdw.data.offset == 0
        assert len(cdw.data.results) > 0

        assert type(cdw) is ComicDataWrapper
        assert type(cdw.data) is ComicDataContainer
        assert type(cdw.data.results) is list
        
    def test_get_comics(self):
        cdw = self.m.get_comics(orderBy="issueNumber,-modified", limit="10", offset="15")

        assert cdw.code == 200
        assert cdw.status == 'Ok'

        assert cdw.data.count > 0
        assert cdw.data.offset == 15
        assert cdw.data.limit == 10
        assert len(cdw.data.results) > 0

        assert type(cdw) is ComicDataWrapper
        assert type(cdw.data) is ComicDataContainer
        assert type(cdw.data.results) is list

        for c in cdw.data.results:
            print "%s - %s" % (c.id, c.title)
            
            
if __name__ == '__main__':
    unittest.main()
<commit_msg>character get_comics parameter test<commit_after>import json
import os
import unittest

from .marvel import Marvel
from .character import CharacterDataWrapper, CharacterDataContainer, Character
from .comic import ComicDataWrapper, ComicDataContainer, Comic
from .config import *

class PyMarvelTestCase(unittest.TestCase):

    def setUp(self):
        self.m = Marvel(PUBLIC_KEY, PRIVATE_KEY)

    def tearDown(self):
        pass

    def test_get_character(self):
        cdw = self.m.get_character(1009718)

        assert cdw.code == 200
        assert cdw.status == 'Ok'
        assert cdw.data.results[0].name == "Wolverine"

        print "\nGet Character: \n"
        print cdw.data.results[0].name

    def test_get_character_get_comics(self):
        character = self.m.get_character(1009718).data.results[0]
        comic_dw = character.get_comics()

        assert comic_dw.code == 200
        assert comic_dw.status == 'Ok'
        
        print "\nWolverine comics: \n"
        for c in comic_dw.data.results:
            print "%s - %s" % (c.id, c.title)

        comic_dw_params = character.get_comics(format="comic", formatType="comic", hasDigitalIssue=True, orderBy="title", limit=10, offset=30)

        assert comic_dw_params.code == 200
        assert comic_dw_params.status == 'Ok'
        
        print "\nWolverine comics with parameters: \n"
        for c in comic_dw_params.data.results:
            print "%s - %s" % (c.id, c.title)


    def test_get_characters(self):
        cdw = self.m.get_characters(orderBy="name,-modified", limit="10", offset="15")

        assert cdw.code == 200
        assert cdw.status == 'Ok'

        assert cdw.data.count > 0
        assert cdw.data.offset == 15
        assert cdw.data.limit == 10
        assert len(cdw.data.results) > 0

        assert type(cdw) is CharacterDataWrapper
        assert type(cdw.data) is CharacterDataContainer
        assert type(cdw.data.results) is list

        print "\nGet Characters: \n"
        for c in cdw.data.results:
            print "%s - %s" % (c.id, c.name)

    def test_get_characters_next(self):
        cdw = self.m.get_characters(orderBy="name,-modified", limit="20", offset="15")
        new_cdw = cdw.next()

        assert new_cdw.code == 200

        #poor test?
        assert new_cdw.data.offset == cdw.data.offset + cdw.data.limit


    def test_get_comic(self):
        cdw = self.m.get_comic(41530)

        assert cdw.code == 200
        assert cdw.status == 'Ok'

        assert cdw.data.count > 0
        assert cdw.data.offset == 0
        assert len(cdw.data.results) > 0

        assert type(cdw) is ComicDataWrapper
        assert type(cdw.data) is ComicDataContainer
        assert type(cdw.data.results) is list
        
    def test_get_comics(self):
        cdw = self.m.get_comics(orderBy="issueNumber,-modified", limit="10", offset="15")

        assert cdw.code == 200
        assert cdw.status == 'Ok'

        assert cdw.data.count > 0
        assert cdw.data.offset == 15
        assert cdw.data.limit == 10
        assert len(cdw.data.results) > 0

        assert type(cdw) is ComicDataWrapper
        assert type(cdw.data) is ComicDataContainer
        assert type(cdw.data.results) is list

        for c in cdw.data.results:
            print "%s - %s" % (c.id, c.title)
            
            
if __name__ == '__main__':
    unittest.main()

{'fraction_non_alphanumeric': 0.11103969146713803, 'fraction_numerical': 0.02249718785151856, 'mean_word_length': 2.287902799788695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3254982', 'n_tokens_mistral': 2144, 'n_tokens_neox': 1965, 'n_words': 469}