Debian Codegraph @

test/httpx/classes.py

raw
1 # SPDX-License-Identifier: MPL-2.0
2
3 import unittest
4
5
6 class TestCasesBasesHttpHeader:
7 class MinimalHeader(unittest.TestCase):
8 _header_minimal = None
9 _header_minimal_bytes = None
10 _header_minimal_markdown = None
11
12 def test_parse_minimal(self):
13 parsed_header = self._header_minimal.parse_exact_size(self._header_minimal_bytes)
14 self.assertEqual(parsed_header, self._header_minimal)
15
16 def test_compose_minimal(self):
17 self.assertEqual(self._header_minimal.compose(), self._header_minimal_bytes)
18
19 def test_markdown(self):
20 self.assertEqual(self._header_minimal.as_markdown(), self._header_minimal_markdown)
21
22 class FullHeaderBase(unittest.TestCase):
23 _header_full = None
24 _header_full_bytes = None
25
26 class FullHeader(FullHeaderBase):
27 def test_parse_full(self):
28 parsed_header = self._header_full.parse_exact_size(self._header_full_bytes)
29 self.assertEqual(parsed_header, self._header_full)
30
31 def test_compose_full(self):
32 self.assertEqual(self._header_full.compose(), self._header_full_bytes)
33
34 class CaseInsensitiveHeader(FullHeaderBase):
35 _header_full_upper_case_bytes = None
36 _header_full_lower_case_bytes = None
37
38 def test_parse_upper_case(self):
39 parsed_header = self._header_full.parse_exact_size(self._header_full_upper_case_bytes)
40 self.assertEqual(parsed_header, self._header_full)
41
42 def test_parse_lower_case(self):
43 parsed_header = self._header_full.parse_exact_size(self._header_full_lower_case_bytes)
44 self.assertEqual(parsed_header, self._header_full)