Exemple #1
0
 def test_satisfies_single_letter_rule_2_bcd_20(self):
     cursor = Cursor([['A', 'B'], [None, 'D']])
     cursor._position = (2, 0)
     self.assertFalse(cursor.satisfies_single_letter_rule(['B']))
Exemple #2
0
 def test_satisfies_single_letter_rule_2_abc_11(self):
     cursor = Cursor([['A', 'B'], ['C', None]])
     cursor._position = (1, 1)
     self.assertFalse(cursor.satisfies_single_letter_rule(['C']))
Exemple #3
0
 def test_satisfies_single_letter_rule_2_abc_20(self):
     cursor = Cursor([['A', 'B'], ['C', None]])
     cursor._position = (2, 0)
     self.assertTrue(cursor.satisfies_single_letter_rule(['A', 'B']))
Exemple #4
0
 def test_find_sequences_2_abd(self):
     cursor = Cursor([['A', 'B'], [None, 'D']])
     self.assertEqual(cursor.find_sequences(), {('A', 'B')})
Exemple #5
0
 def test_find_sequences_2_bcd(self):
     cursor = Cursor([[None, 'B'], ['C', 'D']])
     self.assertEqual(cursor.find_sequences(), {('C', 'D')})
Exemple #6
0
 def test_read_northwest_value(self):
     cursor = Cursor([['A']])
     cursor._position = (1, 1)
     self.assertEqual(cursor.read(-1, -1), 'A')
Exemple #7
0
 def test_read_out_of_range(self):
     cursor = Cursor([[]])
     self.assertIsNone(cursor.read())
Exemple #8
0
 def test_initial_position(self):
     cursor = Cursor([[]])
     self.assertEqual(cursor.position, (0, 0))
Exemple #9
0
 def test_has_more_rows_negative(self):
     cursor = Cursor([[1]])
     cursor.advance_row()
     self.assertTrue(cursor.has_more_rows())
Exemple #10
0
 def test_advance(self):
     cursor = Cursor([[1]])
     cursor.advance()
     self.assertEqual(cursor.position, (1, 0))
Exemple #11
0
 def test_has_more_rows_positive(self):
     cursor = Cursor([[1]])
     self.assertTrue(cursor.has_more_rows())
Exemple #12
0
 def test_beyond_fence_1_positive(self):
     cursor = Cursor([[1]])
     cursor.advance()
     cursor.advance()
     self.assertTrue(cursor.beyond_fence())
Exemple #13
0
 def test_beyond_fence_1_negative(self):
     cursor = Cursor([[1]])
     cursor.advance()
     self.assertFalse(cursor.beyond_fence())
Exemple #14
0
 def test_beyond_fence_0_negative(self):
     cursor = Cursor([[]])
     self.assertFalse(cursor.beyond_fence())
Exemple #15
0
 def test_satisfies_single_letter_rule_2_ad_10(self):
     cursor = Cursor([['A', None], [None, 'D']])
     cursor._position = (1, 0)
     self.assertTrue(cursor.satisfies_single_letter_rule(['A']))
Exemple #16
0
 def test_advance_row(self):
     cursor = Cursor([[]])
     cursor.advance_row()
     self.assertEqual(cursor.position, (0, 1))
Exemple #17
0
 def test_read_value(self):
     cursor = Cursor([[1]])
     self.assertEqual(cursor.read(), 1)
Exemple #18
0
 def test_find_sequences_2_abc(self):
     cursor = Cursor([['A', 'B'], ['C', None]])
     self.assertEqual(cursor.find_sequences(), {('A', 'B')})
Exemple #19
0
 def test_read_northwest_out_of_bounds(self):
     cursor = Cursor([['A']])
     cursor._position = (0, 0)
     self.assertIsNone(cursor.read(-1, -1))
Exemple #20
0
 def test_read_value_x_y(self):
     cursor = Cursor([[1], [2]])
     cursor.advance_row()
     self.assertEqual(cursor.read(), 2)