def test_empty_report(self): # Have the dependencies return an empty report # (this is the default) # Verify that we got the expected string expected = load_fixture('html_report_empty.html') self.assert_report(expected)
def test_empty_report(self): # Have the dependencies return an empty report # (this is the default) # Verify that we got the expected string expected = load_fixture('html_report_empty.html') self.assert_report(expected)
def test_style_defs(self): style_str = Snippet.style_defs() expected_styles = load_fixture(self.FIXTURES['style']).strip() # Check that a sample of the styles are present # (use only a sample to make the test more robust # against Pygment changes). for expect_line in expected_styles.split('\n'): self.assertIn(expect_line, style_str)
def _assert_format(self, src_tokens, src_filename, start_line, violation_lines, expected_fixture): snippet = Snippet(src_tokens, src_filename, start_line, violation_lines) result = snippet.html() expected_str = load_fixture(expected_fixture, encoding="utf-8") assert_long_str_equal(expected_str, result, strip=True) self.assertTrue(isinstance(result, six.text_type))
def test_style_defs(self): style_str = Snippet.style_defs() expected_styles = load_fixture(self.FIXTURES['style']).strip() # Check that a sample of the styles are present # (use only a sample to make the test more robust # against Pygment changes). for expect_line in expected_styles.split('\n'): self.assertIn(expect_line, style_str)
def test_multiple_snippets(self): self.use_default_values() # Have the snippet loader always report # multiple snippets for each source file self.set_num_snippets(2) # Verify that we got the expected string expected = load_fixture('html_report_two_snippets.html').strip() self.assert_report(expected)
def test_one_snippet(self): self.use_default_values() # Have the snippet loader always report # provide one snippet (for every source file) self.set_num_snippets(1) # Verify that we got the expected string expected = load_fixture('html_report_one_snippet.html').strip() self.assert_report(expected)
def test_multiple_snippets(self): self.use_default_values() # Have the snippet loader always report # multiple snippets for each source file self.set_num_snippets(2) # Verify that we got the expected string expected = load_fixture('html_report_two_snippets.html').strip() self.assert_report(expected)
def test_one_snippet(self): self.use_default_values() # Have the snippet loader always report # provide one snippet (for every source file) self.set_num_snippets(1) # Verify that we got the expected string expected = load_fixture('html_report_one_snippet.html').strip() self.assert_report(expected)
def _assert_format(self, src_tokens, src_filename, start_line, violation_lines, expected_fixture): snippet = Snippet(src_tokens, src_filename, start_line, violation_lines) result = snippet.html() expected_str = load_fixture(expected_fixture, encoding='utf-8') assert_long_str_equal(expected_str, result, strip=True) self.assertTrue(isinstance(result, six.text_type))
def _assert_format( self, src_tokens, src_filename, start_line, last_line, violation_lines, expected_fixture, ): snippet = Snippet(src_tokens, src_filename, start_line, last_line, violation_lines, None) result = snippet.html() expected_str = load_fixture(expected_fixture, encoding="utf-8") assert_long_str_equal(expected_str, result, strip=True) self.assertIsInstance(result, str)
def test_generate_report(self): self.use_default_values() expected = load_fixture('html_report.html') self.assert_report(expected)
def test_generate_report(self): self.use_default_values() expected = load_fixture('html_report.html') self.assert_report(expected)