<commit_before>#!/usr/bin/python

import unittest
import dougrain

class ParseSimpleTest(unittest.TestCase):
    def setUp(self):
        self.doc = dougrain.Document.from_object({"name": "<NAME>"})

    def testParseSimple(self):
        self.assertEquals(self.doc.name, "<NAME>")

    def testHasEmptyLinks(self):
        self.assertEquals(self.doc.links, {})

    def testHasAttrs(self):
        self.assertEquals(self.doc.attrs["name"], "<NAME>")

class ParseLinksTest(unittest.TestCase):
    def setUp(self):
        self.doc = dougrain.Document.from_object({
            "_links": {
                "self": {"href": "dougrain"},
                "next": {
                    "href": "http://localhost/wharris/esmre",
                    "label": "Next"
                },
                "parent": {"href": "/wharris/"},
                "images": [
                    {"href": "/foo"},
                    {"href": "/bar"}
                ],
            }
        }, relative_to_url="http://localhost/wharris/dougrain")

    def testLoadsSingleLinkHref(self):
        self.assertEquals("http://localhost/wharris/esmre",
                          self.doc.links["next"].href)

    def testLoadsSingleLinkURL(self):<commit_msg>Add whitespace between classes.<commit_after>#!/usr/bin/python

import unittest
import dougrain

class ParseSimpleTest(unittest.TestCase):
    def setUp(self):
        self.doc = dougrain.Document.from_object({"name": "<NAME>"})

    def testParseSimple(self):
        self.assertEquals(self.doc.name, "<NAME>")

    def testHasEmptyLinks(self):
        self.assertEquals(self.doc.links, {})

    def testHasAttrs(self):
        self.assertEquals(self.doc.attrs["name"], "<NAME>")


class ParseLinksTest(unittest.TestCase):
    def setUp(self):
        self.doc = dougrain.Document.from_object({
            "_links": {
                "self": {"href": "dougrain"},
                "next": {
                    "href": "http://localhost/wharris/esmre",
                    "label": "Next"
                },
                "parent": {"href": "/wharris/"},
                "images": [
                    {"href": "/foo"},
                    {"href": "/bar"}
                ],
            }
        }, relative_to_url="http://localhost/wharris/dougrain")

    def testLoadsSingleLinkHref(self):
        self.assertEquals("http://localhost/wharris/esmre",
                          self.doc.links["next"].href)

    def testLoadsSingleLinkURL(self):
{'fraction_non_alphanumeric': 0.1558598469593234, 'fraction_numerical': 0.0, 'mean_word_length': 1.9361702127659575, 'pattern_counts': {'":': 24, '<': 9, '<?xml version=': 0, '>': 9, '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': '3061451', 'n_tokens_mistral': 744, 'n_tokens_neox': 704, 'n_words': 108}