示例#1
0
        def product_matched(path):
            """Checks if the product field matches expected product name.

            @returns: True if the product name matches, False otherwise.

            """
            read_product_name = base_utils.read_one_line(path)
            logging.debug('Read product at %s = %s', path, read_product_name)
            return read_product_name == product_name
 def test_preserves_leading_whitespace(self):
     self.create_test_file("   has leading whitespace")
     self.assertEqual("   has leading whitespace",
                      base_utils.read_one_line("filename"))
 def test_works_on_file_with_no_newlines(self):
     self.create_test_file("line but no newline")
     self.assertEqual("line but no newline",
                      base_utils.read_one_line("filename"))
     self.god.check_playback()
 def test_works_on_empty_file(self):
     self.create_test_file("")
     self.assertEqual("", base_utils.read_one_line("filename"))
     self.god.check_playback()
 def test_drops_extra_lines(self):
     self.create_test_file("line 1\nline 2\nline 3\n")
     self.assertEqual("line 1", base_utils.read_one_line("filename"))
     self.god.check_playback()
 def test_strips_read_lines(self):
     self.create_test_file("abc   \n")
     self.assertEqual("abc   ", base_utils.read_one_line("filename"))
     self.god.check_playback()
示例#7
0
 def test_preserves_leading_whitespace(self):
     self.create_test_file("   has leading whitespace")
     self.assertEqual("   has leading whitespace",
                      base_utils.read_one_line("filename"))
示例#8
0
 def test_works_on_file_with_no_newlines(self):
     self.create_test_file("line but no newline")
     self.assertEqual("line but no newline",
                      base_utils.read_one_line("filename"))
     self.god.check_playback()
示例#9
0
 def test_works_on_empty_file(self):
     self.create_test_file("")
     self.assertEqual("", base_utils.read_one_line("filename"))
     self.god.check_playback()
示例#10
0
 def test_drops_extra_lines(self):
     self.create_test_file("line 1\nline 2\nline 3\n")
     self.assertEqual("line 1", base_utils.read_one_line("filename"))
     self.god.check_playback()
示例#11
0
 def test_strips_read_lines(self):
     self.create_test_file("abc   \n")
     self.assertEqual("abc   ", base_utils.read_one_line("filename"))
     self.god.check_playback()