def test_111(self): statement = '''SET Evidence = "1.1.1 Easy case"''' expect = '''SET Evidence = "1.1.1 Easy case''' lines = list(sanitize_file_lines(statement.split('\n'))) self.assertEqual(1, len(lines)) line = lines[0] self.assertTrue(expect, line)
def test_e(self): path = os.path.join(dir_path, 'bel', 'test_bel.bel') with open(path) as f: lines = list(sanitize_file_lines(f)) self.assertEqual(26, len(lines))
def test_c(self): s = ['SET Evidence = "yada yada yada" //this is a comment'] result = list(sanitize_file_lines(s)) expect = [(1, 'SET Evidence = "yada yada yada"')] self.assertEqual(expect, result)
def test_d(self): """Test forgotten delimiters""" s = ['SET Evidence = "Something', 'or other', 'or other"'] result = list(sanitize_file_lines(s)) expect = [(1, 'SET Evidence = "Something or other or other"')] self.assertEqual(expect, result)
def test_141(self): statement = '''SET Evidence = "4.1 Malformed line breakcase second line"''' expect = '''SET Evidence = "4.1 Malformed line breakcase second line"''' lines = [ line for i, line in sanitize_file_lines(statement.split('\n')) ] self.assertEqual(1, len(lines)) line = lines[0] self.assertEqual(expect, line)
def test_132(self): statement = '''SET Evidence = "3.2 Backward slash break test with whitespace \\ second line"''' expect = '''SET Evidence = "3.2 Backward slash break test with whitespace second line"''' lines = [ line for i, line in sanitize_file_lines(statement.split('\n')) ] self.assertEqual(1, len(lines)) line = lines[0] self.assertEqual(expect, line)
def test_a(self): s = '''SET Evidence = "The phosphorylation of S6K at Thr389, which is the TORC1-mediated site, was not inhibited in the SIN1-/- cells (Figure 5A)."'''.split('\n') expect = [( 1, 'SET Evidence = "The phosphorylation of S6K at Thr389, which is the TORC1-mediated site, was not inhibited ' 'in the SIN1-/- cells (Figure 5A)."')] result = list(sanitize_file_lines(s)) self.assertEqual(expect, result)
def test_b(self): s = [ '# Set document-defined annotation values\n', 'SET Species = 9606', 'SET Tissue = "t-cells"', '# Create an Evidence Line for a block of BEL Statements', 'SET Evidence = "Here we show that interfereon-alpha (IFNalpha) is a potent producer \\', 'of SOCS expression in human T cells, as high expression of CIS, SOCS-1, SOCS-2, \\', 'and SOCS-3 was detectable after IFNalpha stimulation. After 4 h of stimulation \\', 'CIS, SOCS-1, and SOCS-3 had ret' ] result = list(sanitize_file_lines(s)) expect = [ (2, 'SET Species = 9606'), (3, 'SET Tissue = "t-cells"'), (5, 'SET Evidence = "Here we show that interfereon-alpha (IFNalpha) is a potent producer of SOCS expression in ' 'human T cells, as high expression of CIS, SOCS-1, SOCS-2, and SOCS-3 was detectable after IFNalpha ' 'stimulation. After 4 h of stimulation CIS, SOCS-1, and SOCS-3 had ret' ) ] self.assertEqual(expect, result)
def test_f(self): s = '''SET Evidence = "Arterial cells are highly susceptible to oxidative stress, which can induce both necrosis and apoptosis (programmed cell death) [1,2]"'''.split('\n') lines = list(sanitize_file_lines(s)) self.assertEqual(1, len(lines))
def test_e(self): with open(test_bel_simple) as f: lines = list(sanitize_file_lines(f)) self.assertEqual(26, len(lines))