Пример #1
0
 def test_call_without_buffer(self):
     """
     Function should always be called with a buffer provided to return
     content of previous files if needed.
     """
     with self.assertRaises(TypeError):
         get_content_by_number(14)
Пример #2
0
 def test_random_string(self):
     content = get_content_by_number(42, self.BUFFER)
     self.assertTrue(len(content) <= MIN_LINE_LENGTH)
     self.assertTrue(len(content) <= MAX_LINE_LEGTH)
     self.assertNotEqual(content, self.BUFFER)
     self.assertNotEqual(content, self.FIFTH_LINE)
Пример #3
0
 def test_divisible_both_by_five_and_seven(self):
     # should ignore previous rules and return concatenated content of
     # previous files
     content = get_content_by_number(35, self.BUFFER)
     self.assertEqual(content, self.BUFFER)
Пример #4
0
 def test_divisible_by_seven(self):
     content = get_content_by_number(49, self.BUFFER)
     self.assertEqual(content, self.BUFFER)
Пример #5
0
 def test_divisible_by_five(self):
     content = get_content_by_number(25, self.BUFFER)
     self.assertEqual(content, self.FIFTH_LINE)
Пример #6
0
 def test_seventh_line(self):
     content = get_content_by_number(7, self.BUFFER)
     self.assertEqual(content, self.BUFFER)
Пример #7
0
 def test_fifth_line(self):
     content = get_content_by_number(5, self.BUFFER)
     self.assertEqual(content, self.FIFTH_LINE)