<commit_before>import unittest
from .. import condition
from .. import time_series
import pandas as pd

class TestTimeSeries(unittest.TestCase):

    def test_1_condition(self):
        first = condition.Condition("first", {"gene1": 9, "gene2": 0.12})
        ts = time_series.TimeSeries(first)
        name_order = ts.get_condition_name_order()
        self.assertEqual([first.name], name_order)
        tsv = ts.meta_data_tsv_lines()
        print
        print repr(tsv)
        self.assertEqual('True\t"f"\tNA\tNA\t"first"\n', tsv)
        return ts

    def test_no_add_after_compile(self):
        second = condition.Condition("second", {"gene1": 6, "gene2": 3})
        ts = self.test_1_condition()
        with self.assertRaises(AssertionError):
            ts.add_condition("first", second, 12)

    def test_2_conditions(self):
        first = condition.Condition("first", {"gene1": 9, "gene2": 0.12})
        second = condition.Condition("second", {"gene1": 6, "gene2": 3})
        ts = time_series.TimeSeries(first)
        ts.add_condition("first", second, 12)
        name_order = ts.get_condition_name_order()
        self.assertEqual([first.name, second.name], name_order)
        interval_order = ts.get_interval_order()
        self.assertEqual([0, 12], interval_order)
        name_order_again =  ts.get_condition_name_order()
        assert name_order_again is name_order
        fg1r = ts.get_response_parameters("first", "gene1")
        self.assertEqual(None, fg1r.gene_level_before)
        self.assertEqual(9, fg1r.gene_level)
        self.assertEqual(0, fg1r.time_interval)
        sg1r = ts.get_response_parameters("second", "gene1")
        self.assertEqual(9, sg1r.gene_level_before)
        self.assertEqual(6, sg1r.gene_level)
        self.assertEqual(12, sg1r.time_interval)
        # XXXX
        return ts

    def xtest_3_conditions(self):
        first = condition.Condition("first", {"gene1": 9, "gene2": 0.12})
        second = condition.Condition("second", {"gene1": 6, "gene2": 3})
        third = condition.Condition("third", {"gene1": 3, "gene2": 1})<commit_msg>remove test print<commit_after>import unittest
from .. import condition
from .. import time_series
import pandas as pd

class TestTimeSeries(unittest.TestCase):

    def test_1_condition(self):
        first = condition.Condition("first", {"gene1": 9, "gene2": 0.12})
        ts = time_series.TimeSeries(first)
        name_order = ts.get_condition_name_order()
        self.assertEqual([first.name], name_order)
        tsv = ts.meta_data_tsv_lines()
        self.assertEqual('True\t"f"\tNA\tNA\t"first"\n', tsv)
        return ts

    def test_no_add_after_compile(self):
        second = condition.Condition("second", {"gene1": 6, "gene2": 3})
        ts = self.test_1_condition()
        with self.assertRaises(AssertionError):
            ts.add_condition("first", second, 12)

    def test_2_conditions(self):
        first = condition.Condition("first", {"gene1": 9, "gene2": 0.12})
        second = condition.Condition("second", {"gene1": 6, "gene2": 3})
        ts = time_series.TimeSeries(first)
        ts.add_condition("first", second, 12)
        name_order = ts.get_condition_name_order()
        self.assertEqual([first.name, second.name], name_order)
        interval_order = ts.get_interval_order()
        self.assertEqual([0, 12], interval_order)
        name_order_again =  ts.get_condition_name_order()
        assert name_order_again is name_order
        fg1r = ts.get_response_parameters("first", "gene1")
        self.assertEqual(None, fg1r.gene_level_before)
        self.assertEqual(9, fg1r.gene_level)
        self.assertEqual(0, fg1r.time_interval)
        sg1r = ts.get_response_parameters("second", "gene1")
        self.assertEqual(9, sg1r.gene_level_before)
        self.assertEqual(6, sg1r.gene_level)
        self.assertEqual(12, sg1r.time_interval)
        # XXXX
        return ts

    def test_3_conditions(self):
        first = condition.Condition("first", {"gene1": 9, "gene2": 0.12})
        second = condition.Condition("second", {"gene1": 6, "gene2": 3})
        third = condition.Condition("third", {"gene1": 3, "gene2": 1})
{'fraction_non_alphanumeric': 0.13227893601725377, 'fraction_numerical': 0.02923556194584232, 'mean_word_length': 3.132673267326733, 'pattern_counts': {'":': 28, '<': 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': '6711380', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1313, 'n_words': 254}