<commit_before>from selenium import webdriver
from selenium.webdriver.common import proxy
from selenium.webdriver.support import wait
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time

import unittest

import ipdb
#ipdb.set_trace()


def start_adh_session():
    capabilities = {
        "browserName": "firefox",
        "version": "",
        "platform": "ANY",
        "javascriptEnabled": True,
    }
    selenium_grid_url = "http://localhost:4444/wd/hub"
    driver = webdriver.Remote(desired_capabilities=capabilities, command_executor=selenium_grid_url)

    #waiter = wait.WebDriverWait(driver, 0.1)
    driver.set_page_load_timeout(15)
    driver.implicitly_wait(0.2)

    driver.get("http://lig:6541/frontend_static/root.html")
    assert "adhocracy root page" in driver.title

    return driver


class TestDeepCp(unittest.TestCase):
    def setUp(self):
        self.driver = start_adh_session()

    def tearDown(self):
        self.driver.close()

    def _test_any(self, obj_in):
        obj_out = self.driver.execute_script("var U = require('Adhocracy/Util'); return U.deepcp(arguments[0]);", obj_in);
        self.assertEqual(obj_in, obj_out)

    def test_null(self):
        self._test_any(None)

    def test_empty_obj(self):
        self._test_any({})

    def test_some_obj(self):
        self._test_any({u"a": 3, u"b": [None]})<commit_msg>[R] Gardening<commit_after>from selenium import webdriver
from selenium.webdriver.common import proxy
from selenium.webdriver.support import wait
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time

import unittest


def start_adh_session():
    capabilities = {
        "browserName": "firefox",
        "version": "",
        "platform": "ANY",
        "javascriptEnabled": True,
    }
    selenium_grid_url = "http://localhost:4444/wd/hub"
    driver = webdriver.Remote(desired_capabilities=capabilities, command_executor=selenium_grid_url)

    #waiter = wait.WebDriverWait(driver, 0.1)
    driver.set_page_load_timeout(15)
    driver.implicitly_wait(0.2)

    driver.get("http://lig:6541/frontend_static/root.html")
    assert "adhocracy root page" in driver.title

    return driver


class TestDeepCp(unittest.TestCase):
    def setUp(self):
        self.driver = start_adh_session()

    def tearDown(self):
        self.driver.close()

    def _test_any(self, obj_in):
        obj_out = self.driver.execute_script(
            """
            var U = require('Adhocracy/Util');
            return U.deepcp(arguments[0]);
            """,
            obj_in);
        self.assertEqual(obj_in, obj_out)

    def test_null(self):
        self._test_any(None)

    def test_empty_obj(self):
        self._test_any({})

    def test_some_obj(self):
        self._test_any({u"a": 3, u"b": [None]})
{'fraction_non_alphanumeric': 0.11639118457300275, 'fraction_numerical': 0.011019283746556474, 'mean_word_length': 3.3618618618618616, 'pattern_counts': {'":': 12, '<': 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': '1792660', 'n_tokens_mistral': 981, 'n_tokens_neox': 911, 'n_words': 176}