<commit_before>#!/usr/bin/env python

from nose.tools import raises, assert_equal
from ..apis.api import requestURL
import socket


class TestRequestURL:
    @classmethod
    def setup_class(cls):
        cls.oldsocket = socket.socket

    @staticmethod
    def guard(*args, **kwargs):
        raise Exception("Internet access intentionally blocked.")

    def test_empty_json(self):
        branch = "devel"
        url = ("https://github.com/Sebelino/SL-CLI/tree/{}/slcli/test/assets/js"
               "on/empty.json").format(branch)
        returned = requestURL(url)
        expected = {}
        assert_equal(returned, expected)

    def test_nontrivial_json(self):
        pass

    def test_non_json(self):
        pass

    @raises(Exception)
    def test_closed_socket(self):
        socket.socket = self.guard
        requestURL(self.url)

    def teardown(self):
        """ Restore internet connection in case it was blocked """
        socket.socket = self.oldsocket<commit_msg>pass -> assert False.<commit_after>#!/usr/bin/env python

from nose.tools import raises, assert_equal
from ..apis.api import requestURL
import socket


class TestRequestURL:
    @classmethod
    def setup_class(cls):
        cls.oldsocket = socket.socket

    @staticmethod
    def guard(*args, **kwargs):
        raise Exception("Internet access intentionally blocked.")

    def test_empty_json(self):
        branch = "devel"
        url = ("https://github.com/Sebelino/SL-CLI/tree/{}/slcli/test/assets/js"
               "on/empty.json").format(branch)
        returned = requestURL(url)
        expected = {}
        assert_equal(returned, expected)

    def test_nontrivial_json(self):
        assert False

    def test_non_json(self):
        assert False

    @raises(Exception)
    def test_closed_socket(self):
        socket.socket = self.guard
        requestURL(self.url)

    def teardown(self):
        """ Restore internet connection in case it was blocked """
        socket.socket = self.oldsocket
{'fraction_non_alphanumeric': 0.10707171314741036, 'fraction_numerical': 0.0, 'mean_word_length': 2.6394927536231885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '733836', 'n_tokens_mistral': 596, 'n_tokens_neox': 575, 'n_words': 133}