citeget 0.2.26__tar.gz → 0.2.28__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/acquire-references/SKILL.md +1 -1
  2. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/fetch-resources/SKILL.md +1 -1
  3. {citeget-0.2.26 → citeget-0.2.28}/PKG-INFO +5 -3
  4. {citeget-0.2.26 → citeget-0.2.28}/README.md +2 -0
  5. {citeget-0.2.26 → citeget-0.2.28}/citeget/cli.py +7 -2
  6. {citeget-0.2.26 → citeget-0.2.28}/citeget/netguard.py +45 -2
  7. {citeget-0.2.26 → citeget-0.2.28}/citeget/resolve.py +17 -0
  8. {citeget-0.2.26 → citeget-0.2.28}/pyproject.toml +3 -3
  9. {citeget-0.2.26 → citeget-0.2.28}/tests/conftest.py +9 -2
  10. {citeget-0.2.26 → citeget-0.2.28}/tests/test_resolve.py +21 -0
  11. citeget-0.2.28/tests/test_response_charset.py +40 -0
  12. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/SKILL.md +0 -0
  13. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/add-references.skill +0 -0
  14. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/references/TEMPLATE.md +0 -0
  15. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/references/ai-ml.md +0 -0
  16. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/references/math-combinatorics.md +0 -0
  17. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/references/parameters.md +0 -0
  18. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/references/social-sciences.md +0 -0
  19. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/add-references/references/tech-blog.md +0 -0
  20. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/check-submission-fit/SKILL.md +0 -0
  21. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/format-for-journal/SKILL.md +0 -0
  22. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/get-books/SKILL.md +0 -0
  23. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/prepare-submission/SKILL.md +0 -0
  24. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/research-topic/SKILL.md +0 -0
  25. {citeget-0.2.26 → citeget-0.2.28}/.claude/skills/review-article/SKILL.md +0 -0
  26. {citeget-0.2.26 → citeget-0.2.28}/.editorconfig +0 -0
  27. {citeget-0.2.26 → citeget-0.2.28}/.gitattributes +0 -0
  28. {citeget-0.2.26 → citeget-0.2.28}/.github/workflows/ci.yml +0 -0
  29. {citeget-0.2.26 → citeget-0.2.28}/.gitignore +0 -0
  30. {citeget-0.2.26 → citeget-0.2.28}/CHANGELOG.md +0 -0
  31. {citeget-0.2.26 → citeget-0.2.28}/CLAUDE.md +0 -0
  32. {citeget-0.2.26 → citeget-0.2.28}/LICENSE +0 -0
  33. {citeget-0.2.26 → citeget-0.2.28}/citeget/__init__.py +0 -0
  34. {citeget-0.2.26 → citeget-0.2.28}/citeget/__main__.py +0 -0
  35. {citeget-0.2.26 → citeget-0.2.28}/citeget/acquire_references.py +0 -0
  36. {citeget-0.2.26 → citeget-0.2.28}/citeget/article_pub/__init__.py +0 -0
  37. {citeget-0.2.26 → citeget-0.2.28}/citeget/article_pub/data/journal_profiles.json +0 -0
  38. {citeget-0.2.26 → citeget-0.2.28}/citeget/article_pub/scripts/check_article.py +0 -0
  39. {citeget-0.2.26 → citeget-0.2.28}/citeget/article_pub/scripts/extract_references.py +0 -0
  40. {citeget-0.2.26 → citeget-0.2.28}/citeget/article_pub/scripts/word_count.py +0 -0
  41. {citeget-0.2.26 → citeget-0.2.28}/citeget/content.py +0 -0
  42. {citeget-0.2.26 → citeget-0.2.28}/citeget/core.py +0 -0
  43. {citeget-0.2.26 → citeget-0.2.28}/citeget/data/libgen_vg_report.md +0 -0
  44. {citeget-0.2.26 → citeget-0.2.28}/citeget/extract.py +0 -0
  45. {citeget-0.2.26 → citeget-0.2.28}/citeget/fetch.py +0 -0
  46. {citeget-0.2.26 → citeget-0.2.28}/citeget/joblimit.py +0 -0
  47. {citeget-0.2.26 → citeget-0.2.28}/citeget/merge_keyed.py +0 -0
  48. {citeget-0.2.26 → citeget-0.2.28}/citeget/names.py +0 -0
  49. {citeget-0.2.26 → citeget-0.2.28}/citeget/rank.py +0 -0
  50. {citeget-0.2.26 → citeget-0.2.28}/citeget/validate.py +0 -0
  51. {citeget-0.2.26 → citeget-0.2.28}/cookies.txt +0 -0
  52. {citeget-0.2.26 → citeget-0.2.28}/tests/__init__.py +0 -0
  53. {citeget-0.2.26 → citeget-0.2.28}/tests/cli_goldens/citeget.json +0 -0
  54. {citeget-0.2.26 → citeget-0.2.28}/tests/cli_goldens/citeget_module.json +0 -0
  55. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/danluu_wat.full.md +0 -0
  56. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/danluu_wat.html +0 -0
  57. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/idlewords_haunted_by_data.full.md +0 -0
  58. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/idlewords_haunted_by_data.html +0 -0
  59. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/joelonsoftware_talmud.full.md +0 -0
  60. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/joelonsoftware_talmud.html +0 -0
  61. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/make_fixtures.py +0 -0
  62. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/paulgraham_avg.full.md +0 -0
  63. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/paulgraham_avg.html +0 -0
  64. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/wayback_nytimes_federer.full.md +0 -0
  65. {citeget-0.2.26 → citeget-0.2.28}/tests/fixtures/pages/wayback_nytimes_federer.html +0 -0
  66. {citeget-0.2.26 → citeget-0.2.28}/tests/test_browser_session.py +0 -0
  67. {citeget-0.2.26 → citeget-0.2.28}/tests/test_browserguard.py +0 -0
  68. {citeget-0.2.26 → citeget-0.2.28}/tests/test_cli_surface.py +0 -0
  69. {citeget-0.2.26 → citeget-0.2.28}/tests/test_core_mirrors.py +0 -0
  70. {citeget-0.2.26 → citeget-0.2.28}/tests/test_download_paths.py +0 -0
  71. {citeget-0.2.26 → citeget-0.2.28}/tests/test_extract.py +0 -0
  72. {citeget-0.2.26 → citeget-0.2.28}/tests/test_fetch_ownership_and_extraction.py +0 -0
  73. {citeget-0.2.26 → citeget-0.2.28}/tests/test_fetch_query_collision.py +0 -0
  74. {citeget-0.2.26 → citeget-0.2.28}/tests/test_fetch_retry_titles.py +0 -0
  75. {citeget-0.2.26 → citeget-0.2.28}/tests/test_finalize.py +0 -0
  76. {citeget-0.2.26 → citeget-0.2.28}/tests/test_html_to_markdown.py +0 -0
  77. {citeget-0.2.26 → citeget-0.2.28}/tests/test_job_budget.py +0 -0
  78. {citeget-0.2.26 → citeget-0.2.28}/tests/test_joblimit.py +0 -0
  79. {citeget-0.2.26 → citeget-0.2.28}/tests/test_main_content.py +0 -0
  80. {citeget-0.2.26 → citeget-0.2.28}/tests/test_main_content_pages.py +0 -0
  81. {citeget-0.2.26 → citeget-0.2.28}/tests/test_merge_keyed.py +0 -0
  82. {citeget-0.2.26 → citeget-0.2.28}/tests/test_names.py +0 -0
  83. {citeget-0.2.26 → citeget-0.2.28}/tests/test_netguard.py +0 -0
  84. {citeget-0.2.26 → citeget-0.2.28}/tests/test_rank.py +0 -0
  85. {citeget-0.2.26 → citeget-0.2.28}/tests/test_search_retries.py +0 -0
  86. {citeget-0.2.26 → citeget-0.2.28}/tests/test_validate.py +0 -0
@@ -18,7 +18,7 @@ finding paper PDFs in libgen / arxiv / sci-hub, which won't help for web
18
18
  content.
19
19
 
20
20
  **For a list of book titles** (a reading list, "get me these books") use
21
- `/get-books`. This skill is built around a document's reference section; it
21
+ `/get-books` (`skills/get-books/SKILL.md` in this repository; link it into `~/.claude/skills/` to install). This skill is built around a document's reference section; it
22
22
  does not know which book you asked for, so it cannot check that the file it
23
23
  got is that book. `/get-books` can.
24
24
 
@@ -113,7 +113,7 @@ Every Markdown file starts with a `<!-- Source: URL -->` line, and that line, no
113
113
 
114
114
  - `skip_existing` (the default) skips a URL only when a file of the same format already belongs to it, so a `SKIP` really means "already have this page". A folder saved by an older citeget, under older names, is matched by those headers too: the page is skipped, not saved twice.
115
115
  - Two different URLs never share a file. When the preferred name is taken by another URL, the query is folded in, else a short hash of the URL.
116
- - PDFs and other non-Markdown files carry no source record. Within one run they are still kept apart. Across runs, an existing PDF of the same name is taken to be the same document and skipped: [thorwhalen/citeget#32](https://github.com/thorwhalen/citeget/issues/32) tracks that case.
116
+ - PDFs and other non-Markdown files carry no source record. Within one run they are still kept apart. Across runs, an existing PDF of the same name is taken to be the same document and skipped: [thorwhalen/citeget#32](https://github.com/addaix/citeget/issues/32) tracks that case.
117
117
 
118
118
  ## Format choice (`--prefer` / `prefer=`)
119
119
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: citeget
3
- Version: 0.2.26
3
+ Version: 0.2.28
4
4
  Summary: Find, acquire, and manage academic references — for AI agents and humans.
5
- Project-URL: Homepage, https://github.com/thorwhalen/citeget
6
- Project-URL: Repository, https://github.com/thorwhalen/citeget
5
+ Project-URL: Homepage, https://github.com/addaix/citeget
6
+ Project-URL: Repository, https://github.com/addaix/citeget
7
7
  Author: Thor Whalen
8
8
  License-Expression: Apache-2.0
9
9
  License-File: LICENSE
@@ -278,6 +278,8 @@ Available skills:
278
278
 
279
279
  ## Acquisition strategy
280
280
 
281
+ Which commands can touch which sources: `citeget fetch` only reads the URLs you give it. `citeget acquire` runs the chain below by default; `--strategy open_access` (Python: `acquire_reference(..., strategy="open_access")`) restricts it to the reference's own URL, Unpaywall, arXiv and Semantic Scholar, with no libgen or sci-hub step and no mirror contact. `citeget download` and `citeget get-book` search libgen only and have no open-access mode.
282
+
281
283
  For each reference, `citeget` tries these sources in order:
282
284
 
283
285
  1. **Direct URL** — if the reference includes an arxiv, OpenReview, or other
@@ -241,6 +241,8 @@ Available skills:
241
241
 
242
242
  ## Acquisition strategy
243
243
 
244
+ Which commands can touch which sources: `citeget fetch` only reads the URLs you give it. `citeget acquire` runs the chain below by default; `--strategy open_access` (Python: `acquire_reference(..., strategy="open_access")`) restricts it to the reference's own URL, Unpaywall, arXiv and Semantic Scholar, with no libgen or sci-hub step and no mirror contact. `citeget download` and `citeget get-book` search libgen only and have no open-access mode.
245
+
244
246
  For each reference, `citeget` tries these sources in order:
245
247
 
246
248
  1. **Direct URL** — if the reference includes an arxiv, OpenReview, or other
@@ -137,8 +137,10 @@ def acquire(
137
137
  delay: Seconds between operations (rate limiting).
138
138
  max_refs: Max references to process (0 = all).
139
139
  extractor: Named extractor to use (default, standard, broad, bold, ai).
140
- strategy: Named acquisition strategy (default, direct, doi, arxiv_search,
141
- semantic_scholar, libgen, scihub). Empty uses legacy chain.
140
+ strategy: Named acquisition strategy (default, open_access, direct, doi,
141
+ arxiv_search, semantic_scholar, libgen, scihub). Empty uses the legacy
142
+ chain, which includes libgen and sci-hub; ``open_access`` stays with
143
+ author, publisher and open-access copies.
142
144
  preview: Show extracted references and ask for confirmation.
143
145
  auto: Skip confirmation even in preview mode.
144
146
  """
@@ -329,6 +331,9 @@ def get_book(
329
331
  for and downloads the best candidate that validates as a complete book,
330
332
  falling through to the next one if it turns out to be an excerpt or a stub.
331
333
 
334
+ This command searches libgen only and has no open-access mode. To stay with
335
+ open sources use ``citeget acquire --strategy open_access`` or ``citeget fetch``.
336
+
332
337
  Args:
333
338
  title: The book's title.
334
339
  authors: The author(s), if known — strongly improves matching.
@@ -26,7 +26,8 @@ Every HTTP request citeget makes goes through :func:`get` (or a
26
26
  Because the check is made on the address the socket actually connects to,
27
27
  alternative spellings of a host (``2130706433``, ``0x7f.1``, ``017700000001``,
28
28
  a DNS name that resolves to ``10.0.0.5``) are all caught: they resolve to the
29
- same refused address.
29
+ same refused address. Purely numeric non-canonical hosts are also refused up front
30
+ (:func:`check_url`), because resolvers disagree on what they mean.
30
31
 
31
32
  The guard is on by default. A desktop user who wants citeget to fetch from
32
33
  their own LAN or ``localhost`` can opt out with the environment variable
@@ -47,8 +48,10 @@ citeget.netguard.UnsafeURLError: Refused file:///etc/passwd: scheme 'file' is no
47
48
 
48
49
  from __future__ import annotations
49
50
 
51
+ import codecs
50
52
  import ipaddress
51
53
  import os
54
+ import re
52
55
  import socket
53
56
  from contextlib import contextmanager
54
57
  from contextvars import ContextVar
@@ -290,6 +293,14 @@ def _refuse(url_or_host, reason: str) -> UnsafeURLError:
290
293
  return UnsafeURLError(f"Refused {url_or_host}: {reason}")
291
294
 
292
295
 
296
+ #: A host written only in numbers (``0177.0.0.1``, ``0x7f.1``, ``127.1``, ``2130706433``).
297
+ #: ``inet_aton`` reads these as octal, hex or short forms, macOS's resolver reads ``0177`` as
298
+ #: decimal 177, so one URL names different hosts on different machines: never fetch one.
299
+ _NUMERIC_HOST = re.compile(
300
+ r"(?:0[xX][0-9a-fA-F]+|\d+)(?:\.(?:0[xX][0-9a-fA-F]+|\d+)){0,3}\.?", re.ASCII
301
+ )
302
+
303
+
293
304
  def check_url(url: str, *, policy: Optional[NetPolicy] = None) -> str:
294
305
  """Check the parts of *url* that can be judged without DNS; return it.
295
306
 
@@ -321,7 +332,12 @@ def check_url(url: str, *, policy: Optional[NetPolicy] = None) -> str:
321
332
  try:
322
333
  ipaddress.ip_address(host.split("%", 1)[0])
323
334
  except ValueError:
324
- pass # a name, or a non-canonical IPv4 spelling: judged at connect
335
+ if _NUMERIC_HOST.fullmatch(host):
336
+ raise _refuse(
337
+ url,
338
+ f"{host} is a non-canonical numeric host (resolvers disagree on it)",
339
+ )
340
+ # a name: judged at connect
325
341
  else:
326
342
  if not is_public_address(host):
327
343
  raise _refuse(url, f"{host} is not a public address")
@@ -476,6 +492,13 @@ except ImportError: # pragma: no cover - requests is a hard dependency
476
492
  _requests = None
477
493
 
478
494
 
495
+ #: How much of a body is searched for a ``<meta charset>`` declaration.
496
+ _META_SNIFF_BYTES = 4096
497
+ _META_CHARSET = re.compile(
498
+ rb"""<meta[^>]+charset\s*=\s*["']?\s*([A-Za-z0-9_.:-]+)""", re.I
499
+ )
500
+
501
+
479
502
  class GuardedResponse(_requests.Response if _requests else object):
480
503
  """A ``requests.Response`` that honours a :class:`NetPolicy`'s ceilings.
481
504
 
@@ -537,9 +560,29 @@ class GuardedResponse(_requests.Response if _requests else object):
537
560
  f"for text ({MAX_TEXT_BYTES_ENV_VAR})",
538
561
  )
539
562
 
563
+ def _sniff_encoding(self) -> Optional[str]:
564
+ """The encoding of a body whose ``Content-Type`` names no charset.
565
+
566
+ ``requests`` decodes a bare ``text/html`` as Latin-1 (RFC 2616 era), which turns
567
+ UTF-8 ``é`` into two wrong characters. Prefer what the page says about itself
568
+ (``<meta charset>`` / ``http-equiv``), then a guess from the bytes.
569
+ """
570
+ head = self.content[:_META_SNIFF_BYTES]
571
+ match = _META_CHARSET.search(head)
572
+ if match:
573
+ declared = match.group(1).decode("ascii", "ignore")
574
+ try:
575
+ codecs.lookup(declared)
576
+ return declared
577
+ except LookupError:
578
+ pass
579
+ return self.apparent_encoding
580
+
540
581
  @property
541
582
  def text(self):
542
583
  self._check_text_size()
584
+ if "charset" not in (self.headers.get("content-type") or "").lower():
585
+ self.encoding = self._sniff_encoding() or "utf-8"
543
586
  return super().text
544
587
 
545
588
  def json(self, **kwargs):
@@ -748,6 +748,23 @@ def _build_default_strategy() -> AcquisitionStrategy:
748
748
  register_strategy("default", _build_default_strategy())
749
749
 
750
750
 
751
+ def _build_open_access_strategy() -> AcquisitionStrategy:
752
+ """Author, publisher and open-access copies only: no libgen, no sci-hub.
753
+
754
+ ``direct`` (the reference's own URL), ``doi`` (Unpaywall), ``arxiv_search`` and
755
+ ``semantic_scholar`` (open-access PDFs), in that order. No mirror is ever contacted.
756
+ """
757
+ return chain(
758
+ STRATEGIES["direct"],
759
+ STRATEGIES["doi"],
760
+ STRATEGIES["arxiv_search"],
761
+ STRATEGIES["semantic_scholar"],
762
+ )
763
+
764
+
765
+ register_strategy("open_access", _build_open_access_strategy())
766
+
767
+
751
768
  # ---------------------------------------------------------------------------
752
769
  # Main entry point
753
770
  # ---------------------------------------------------------------------------
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "citeget"
9
- version = "0.2.26"
9
+ version = "0.2.28"
10
10
  description = "Find, acquire, and manage academic references — for AI agents and humans."
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.10"
@@ -45,8 +45,8 @@ dependencies = [
45
45
  citeget = "citeget.cli:main"
46
46
 
47
47
  [project.urls]
48
- Homepage = "https://github.com/thorwhalen/citeget"
49
- Repository = "https://github.com/thorwhalen/citeget"
48
+ Homepage = "https://github.com/addaix/citeget"
49
+ Repository = "https://github.com/addaix/citeget"
50
50
 
51
51
  [project.optional-dependencies]
52
52
  dev = [
@@ -6,6 +6,7 @@ response, which records every address the guard lets through.
6
6
  """
7
7
 
8
8
  import socket
9
+ import threading
9
10
 
10
11
  import pytest
11
12
 
@@ -50,8 +51,14 @@ class FakeTransport:
50
51
  canned = self.responses.get(ip, _response(404, b"nope"))
51
52
  if isinstance(canned, list): # one per connection, the last one repeats
52
53
  canned = canned.pop(0) if len(canned) > 1 else canned[0]
53
- theirs.sendall(canned)
54
- theirs.shutdown(socket.SHUT_WR)
54
+ def feed(): # off-thread: a macOS socketpair buffers ~8 KB, a bigger body would block here forever
55
+ try:
56
+ theirs.sendall(canned)
57
+ theirs.shutdown(socket.SHUT_WR)
58
+ except OSError: # the reader closed early (a body cut off at the limit)
59
+ pass
60
+
61
+ threading.Thread(target=feed, daemon=True).start()
55
62
  self._peers.append(theirs)
56
63
  return ours
57
64
 
@@ -161,3 +161,24 @@ def test_chain_resolvers_deduplicates():
161
161
  ref = Reference(number=1, raw="test")
162
162
  urls = combined(ref)
163
163
  assert urls == ["http://a.com", "http://b.com", "http://c.com"]
164
+
165
+
166
+ def test_open_access_strategy_never_reaches_libgen_or_scihub(monkeypatch, tmp_path):
167
+ """`open_access` is the open sources only: a miss there is a miss, not a shadow-library try."""
168
+ from citeget import resolve
169
+
170
+ called = []
171
+
172
+ def stub(name, result=None):
173
+ def strategy(ref, filepath):
174
+ called.append(name)
175
+ return result
176
+ return strategy
177
+
178
+ for name in ("direct", "doi", "arxiv_search", "semantic_scholar", "libgen", "scihub"):
179
+ monkeypatch.setitem(resolve.STRATEGIES, name, stub(name))
180
+ assert "open_access" in list_strategies()
181
+ strategy = resolve._build_open_access_strategy()
182
+ ref = Reference(number=1, raw="test", url="")
183
+ assert strategy(ref, tmp_path / "x.pdf") is None
184
+ assert called == ["direct", "doi", "arxiv_search", "semantic_scholar"]
@@ -0,0 +1,40 @@
1
+ """A body whose Content-Type names no charset is decoded by what the page says, not as Latin-1."""
2
+
3
+ from citeget.netguard import GuardedResponse
4
+
5
+
6
+ def _response(body: bytes, content_type: str | None) -> GuardedResponse:
7
+ r = GuardedResponse()
8
+ r._content = body
9
+ r._content_consumed = True
10
+ r.status_code = 200
11
+ if content_type:
12
+ r.headers["Content-Type"] = content_type
13
+ # what requests does: the header's charset, else Latin-1 for a bare text/*
14
+ r.encoding = (
15
+ content_type.split("charset=")[1] if "charset" in content_type else "ISO-8859-1"
16
+ )
17
+ return r
18
+
19
+
20
+ def test_meta_charset_beats_the_latin1_default():
21
+ body = '<html><head><meta charset="utf-8"></head><body>passé</body></html>'.encode()
22
+ assert "passé" in _response(body, "text/html").text
23
+
24
+
25
+ def test_http_equiv_meta_is_read_too():
26
+ body = (
27
+ '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
28
+ "<p>café</p>"
29
+ ).encode()
30
+ assert "café" in _response(body, "text/html").text
31
+
32
+
33
+ def test_bytes_are_guessed_when_the_page_declares_nothing():
34
+ body = ("<p>" + "passé, où, déjà, très, façon. " * 20 + "</p>").encode()
35
+ assert "passé" in _response(body, "text/html").text
36
+
37
+
38
+ def test_a_declared_charset_is_respected():
39
+ body = "<p>passé</p>".encode("latin-1")
40
+ assert "passé" in _response(body, "text/html; charset=iso-8859-1").text
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes