OLD | NEW |
1 # -*- coding: utf-8; -*- | 1 # -*- coding: utf-8; -*- |
2 # | 2 # |
3 # Copyright (C) 2009 Google Inc. All rights reserved. | 3 # Copyright (C) 2009 Google Inc. All rights reserved. |
4 # Copyright (C) 2009 Torch Mobile Inc. | 4 # Copyright (C) 2009 Torch Mobile Inc. |
5 # Copyright (C) 2009 Apple Inc. All rights reserved. | 5 # Copyright (C) 2009 Apple Inc. All rights reserved. |
6 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) | 6 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) |
7 # | 7 # |
8 # Redistribution and use in source and binary forms, with or without | 8 # Redistribution and use in source and binary forms, with or without |
9 # modification, are permitted provided that the following conditions are | 9 # modification, are permitted provided that the following conditions are |
10 # met: | 10 # met: |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 self._log_stream.assertMessages(messages) | 111 self._log_stream.assertMessages(messages) |
112 | 112 |
113 | 113 |
114 class ConfigureLoggingTest(ConfigureLoggingTestBase): | 114 class ConfigureLoggingTest(ConfigureLoggingTestBase): |
115 | 115 |
116 """Tests the configure_logging() function.""" | 116 """Tests the configure_logging() function.""" |
117 | 117 |
118 is_verbose = False | 118 is_verbose = False |
119 | 119 |
120 def test_warning_message(self): | 120 def test_warning_message(self): |
121 self._log.warn("test message") | 121 self._log.warning("test message") |
122 self.assert_log_messages(["WARNING: test message\n"]) | 122 self.assert_log_messages(["WARNING: test message\n"]) |
123 | 123 |
124 def test_below_warning_message(self): | 124 def test_below_warning_message(self): |
125 # We test the boundary case of a logging level equal to 29. | 125 # We test the boundary case of a logging level equal to 29. |
126 # In practice, we will probably only be calling log.info(), | 126 # In practice, we will probably only be calling log.info(), |
127 # which corresponds to a logging level of 20. | 127 # which corresponds to a logging level of 20. |
128 level = logging.WARNING - 1 # Equals 29. | 128 level = logging.WARNING - 1 # Equals 29. |
129 self._log.log(level, "test message") | 129 self._log.log(level, "test message") |
130 self.assert_log_messages(["test message\n"]) | 130 self.assert_log_messages(["test message\n"]) |
131 | 131 |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 """Test that carriage returns aren't stripped from files that are allowe
d to contain them.""" | 807 """Test that carriage returns aren't stripped from files that are allowe
d to contain them.""" |
808 file_path = 'carriage_returns_allowed.txt' | 808 file_path = 'carriage_returns_allowed.txt' |
809 lines = ['line1\r', 'line2\r'] | 809 lines = ['line1\r', 'line2\r'] |
810 line_numbers = [100] | 810 line_numbers = [100] |
811 self._processor.process(lines=lines, | 811 self._processor.process(lines=lines, |
812 file_path=file_path, | 812 file_path=file_path, |
813 line_numbers=line_numbers) | 813 line_numbers=line_numbers) |
814 # The carriage return checker should never have been invoked, and so | 814 # The carriage return checker should never have been invoked, and so |
815 # should not have saved off any lines. | 815 # should not have saved off any lines. |
816 self.assertFalse(hasattr(self.carriage_checker, 'lines')) | 816 self.assertFalse(hasattr(self.carriage_checker, 'lines')) |
OLD | NEW |