frenzy-ios/ReaderTests/ReaderTests.swift

187 lines
27 KiB
Swift
Raw Normal View History

2021-12-08 02:58:02 +00:00
//
// ReaderTests.swift
// ReaderTests
//
// Created by Shadowfacts on 10/29/21.
//
import XCTest
import Reader
//import SwiftSoup
2021-12-08 02:58:02 +00:00
class ReaderTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
// HTML parsing comparison conducted on iPhone 12 Pro
// SwiftSoup: approx 0.53 sec
// lol-html: approx 0.003 sec
2021-12-08 02:58:02 +00:00
// note: when testing this, make sure to set the Reader scheme to build in release mode for fair comparison
// func testSwiftSoupPerformance() {
// self.measure {
// for i in 0..<100 {
// if i % 10 == 0 {
// print(i)
// }
// let doc = try! SwiftSoup.parseBodyFragment(html)
// let excerpt = try! doc.text()
// }
// }
// }
func testLolHtmlPerformance() {
2021-12-08 02:58:02 +00:00
self.measure {
for i in 0..<100 {
if i % 10 == 0 {
print(i)
}
let excerpt = ExcerptGenerator.excerpt(from: html)
}
2021-12-08 02:58:02 +00:00
}
}
let html = """
<div class="page" id="readability-page-1"><div data-reactid="221"><div data-reactid="222"><p><u>On Tuesday, Republicans</u> on the House Committee on Oversight and Reform <a href="https://republicans-oversight.house.gov/wp-content/uploads/2022/01/Letter-Re.-Feb-1-Emails-011122.pdf">released a letter </a>that
paints a damning picture of U.S. government officials wrestling with
whether the novel coronavirus may have leaked out of a lab they were
funding, acknowledging that it may have, and then keeping the discussion
from spilling out into public view.</p><p>The letter, signed by James Comer, R-Ky., and Jim Jordan, R-Ohio, was followed by pages of notes on <a href="https://s3.documentcloud.org/documents/20793561/leopold-nih-foia-anthony-fauci-emails.pdf">emails</a> that were first obtained through the Freedom of Information Act by <a href="https://www.buzzfeednews.com/article/nataliebettendorf/fauci-emails-covid-response">BuzzFeed News</a> and the <a href="https://www.washingtonpost.com/politics/interactive/2021/tony-fauci-emails/">Washington Post</a>,
but were heavily redacted when published in June 2021. The redacted
emails included the agenda for a February 1, 2020, telephone conference
between National Institute of Allergy and Infectious Diseases director
Anthony Fauci; his then-boss, former National Institutes of Health
director Francis Collins; and several of the worlds leading
virologists. The communications contained extensive notes summarizing
what was said during the call, but their substance was hidden at the
time.</p><p>Oversight Committee staff were able to view the full emails
in camera, which means they could physically look at them and take
notes but couldnt take copies with them. The information released
Tuesday for the first time reveals the content of notes taken on the
February 1 call.</p></div><a data-reactid="223" href="https://beta.documentcloud.org/documents/21177759-house-oversight-letter-and-email-transcriptions"><img data-reactid="224" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wCEAAICAgMDAwMEBAMFBQUFBQcGBgYGBwoHCAcIBwoPCgsKCgsKDw4RDg0OEQ4YExERExgcGBcYHCIfHyIrKSs4OEsBAgICAwMDAwQEAwUFBQUFBwYGBgYHCgcIBwgHCg8KCwoKCwoPDhEODQ4RDhgTERETGBwYFxgcIh8fIispKzg4S//CABEIAtAFoAMBIgACEQEDEQH/xAAdAAEBAQADAQEBAQAAAAAAAAAACggGBwkFAwIE/9oACAEBAAAAAJ/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAWAAAAAAAAAAAAAABYAAAAAAAAAAAAAAAAAAAAAAAAAAAABYAAAAAAAAAAA
that call, virologists Michael Farzan and Robert Garry told Fauci and
Collins the virus might have leaked from the Wuhan lab. It might have
been genetically engineered, the transcription of Garrys notes
suggests, but this now seems unlikely. Another possibility, put forward
by Farzan, was that it could have been evolved in the lab through a
process known as serial passage.</p><p>The email is out-of-context,
Garry wrote Wednesday in an email to The Intercept. This was one email
among many I was sharing with my colleagues.</p></div><div data-reactid="283"><p>The
two methods represent two different ideas behind the so-called lab-leak
hypothesis. The one that gained notoriety early in the pandemic is
genetic engineering, where scientists insert and delete nucleotides in
the viruss genetic code, in this case viral RNA, to turn it into
something new. This version forms the basis of accusations that the
virus was intentionally created as a bioweapon which practically every
credible scientist has dismissed as an illogical conspiracy, but was
quickly embraced by former President Donald Trump and much of the
American right wing, souring scientists, liberals, and the mainstream on
the possibility of lab origin. The less lurid but seemingly more
plausible version is the idea of evolution through serial passage, in
which scientists allow a virus to jump between host species or cell
cultures, spurring new mutations.</p><p>The day before the call, Scripps
Research infectious disease expert Kristian Andersen had warned Fauci
that the virus may have been engineered in a lab, noting that he and
several other high-profile scientists all find the genome inconsistent
with expectations from evolutionary theory. The scientists agreed to
have a conference call the next day. It was a very productive
back-and-forth conversation where some on the call felt it could
possibly be an engineered virus, Fauci told Alison Young, <a href="https://www.usatoday.com/story/opinion/2021/06/17/covid-19-fauci-lab-leaks-wuhan-china-origins/7737494002/">writing for USA Today</a>, in June 2021.</p><p>Not long after the call, Andersen was the lead author on a <a href="https://www.nature.com/articles/s41591-020-0820-9">paper in Nature Medicine</a>
titled The Proximal Origin of SARS-CoV-2. The paper proposed two
scenarios that can plausibly explain the origin of SARS-CoV-2: (i)
natural selection in an animal host before zoonotic transfer; and (ii)
natural selection in humans following zoonotic transfer. For the
scientists and pundits who sought to discount the emerging lab-leak
hypothesis, it offered the authoritative proof they needed. The paper
has since been accessed more than 5.6 million times, with over 2,000
citations.</p><p>The authors acknowledged a third scenario, selection
during passage, but they discussed it briefly and presented it as by
far the least plausible. The newly released notes from the call,
however, suggest that the scientists Fauci consulted initially
considered that possibility to be much more serious than the paper let
on.</p></div><div data-reactid="285"><p>On February 2, Jeremy Farrar, an
infectious disease expert and the director of Wellcome, sent around
notes, including to Fauci and Collins, summarizing what some of the
scientists had said on the call. Farzan, a Scripps professor who studied
the spike protein on the 2003 SARS virus, is bothered by the furin
site and has a hard time explain that as an event outside the lab
(though, there are possible ways in nature, but highly unlikely),
Farrars note reads, referring to a spike protein feature that aids
interaction with furin, a common enzyme in human lung cells. Farzan
didnt think the site was the product of directed engineering, but
found that the changes would be highly compatible with the idea of
continued passage of the virus in tissue culture.</p><p>According to
the transcribed notes, Garry, a professor at the Tulane University
School of Medicine, said on the call that he had aligned the SARS-CoV-2
genome with that of RaTG13, a 96-percent similar virus isolated from
bats at the Wuhan Institute of Virology that was long regarded as the
new viruss closest known relative though a closer one <a href="https://www.nature.com/articles/d41586-021-02596-2">has since been identified</a>.
Garry found that the spike proteins of RaTG13 and SARS-CoV-2, which
makes the latter so infectious, were nearly identical. The key
distinction was in the ability of the new viruss spike protein to
interact with furin, which Garry found too perfect to make natural
sense. I just cant figure out how this gets accomplished in nature,
he said.</p><p>My initial impression and that of others about the
[furin cleavage site] was wrong. I changed my mind with new
information/new data, Garry wrote to The Intercept. Thats how science
works. No one was trying to mislead the public. What was in the
Proximal Origins paper was our best analysis its held up extremely
well.</p></div><div data-reactid="287"><p>As they discussed what to
present to the public, the scientists determined that questions of
potential lab origin might prove more trouble than theyre worth. Given
the evidence presented and the discussions around it, I would conclude
that a follow-up discussion on the possible origin of 2019-nCoV would be
of much interest, wrote Ron Fouchier, a virologist at the Erasmus MC
Center for Viroscience in the Netherlands, on February 2. Years earlier,
Fouchiers gain-of-function research had brought the discipline under
fire for <a href="https://www.science.org/content/article/exclusive-controversial-experiments-make-bird-flu-more-risky-poised-resume">a 2011 experiment</a>
in which he infected ferrets in adjacent cages with the avian influenza
virus, allowing it to become airborne and infect mammals. However,
further debate about such accusations would unnecessarily distract top
researchers from their active duties and do unnecessary harm to science
in general and science in China in particular, Fouchier wrote.</p><p>Farzan, Fauci, and Fouchier did not immediately respond to The Intercepts requests for comment.</p><p>Several
of the scientists on the email chain ended up co-authoring the Nature
Medicine paper with Andersen and Garry. In a February 4 email, which
House Republicans presented as a response to a first copy of the draft,
Fauci wrote: ?? Serial passage in ACE2-transgenic mice.</p><p>The
early draft has not been made public, so we dont know what, exactly,
sparked Faucis reaction. But his words, which refer to the process of
passaging a virus in humanized laboratory mice or mice that have
been genetically modified to express receptors for human ACE2, an enzyme
that occurs in the lungs do not appear in the published paper.</p><p>Neither
Drs. Fauci or Collins edited our Proximal Origins paper in any way. The
major feedback we got from the Feb 1 teleconference was: 1. Dont try
to write a paper at all its unnecessary or 2. If you do write it
dont mention a lab origin as that will just add fuel to the
conspiracists, Garry wrote on Wednesday.</p><p>When the paper appeared
in Nature Medicine on March 17, 2020, it noted near the end that in
order for the novel coronavirus to have emerged in a lab via serial
passage, scientists would have to conduct those experiments using a
relative with very high genetic similarity, but there was no evidence
that such experiments had been done. The authors added, Subsequent
generation of a polybasic cleavage site, which lets the virus process
furin, would have then required repeated passage in cell culture or
animals with ACE2 receptors similar to those of humans, but such work
has also not previously been described.</p><p>Though the paper was
publicly embraced by the scientific community and the mainstream media,
Collins worried that its impact wasnt sufficient. Wondering if there
is something NIH can do to help put down this very destructive
conspiracy, Collins wrote on April 16, 2020, in reference to a Fox News
segment on the lab-leak theory. I hoped the Nature Medicine article on
the genomic sequence of SARS-CoV-2 would settle this. But probably
didnt get much visibility. Anything more we can do?</p><p>I would not do anything about this right now, Fauci replied. It is a shiny object that will go away in times.</p></div></div></div>
"""
2021-12-08 02:58:02 +00:00
}