From dc86283d83ecdfab359c786546745924b5cdf14c Mon Sep 17 00:00:00 2001 From: Richard Harding Date: Wed, 18 Apr 2012 20:12:54 -0400 Subject: [PATCH] Add a sample articler tester and a nyt sample to process --- src/tests/samples/nyt.sample.html | 944 ++++++++++++++++++++++++++++++ src/tests/test_sample_articles.py | 31 + 2 files changed, 975 insertions(+) create mode 100644 src/tests/samples/nyt.sample.html create mode 100644 src/tests/test_sample_articles.py diff --git a/src/tests/samples/nyt.sample.html b/src/tests/samples/nyt.sample.html new file mode 100644 index 0000000..19caa35 --- /dev/null +++ b/src/tests/samples/nyt.sample.html @@ -0,0 +1,944 @@ + + + + + + + + + + +Watches Are Rediscovered by the Cellphone Generation - NYTimes.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+ +Click Here +
+ +
+
+
+ + + + + +
+
+
+
+ + +
+ +

+ +Fashion & Style +

+ +
+ + + + +
+ + +
+ + +
+
+
+
+ +
+

Watches Are Rediscovered by the Cellphone Generation

+
+
Elizabeth Lippman for The New York Times
+
+ + + + +
+
+
+
    + +
  • +Print +
  • +
  • + Single Page +
  • + + + +
  • + + + + + + + + +
    +Reprints +
  • +
    +
+
+ +
+
+
+
+ + + + + + + + + + + + + +

+MICHAEL WILLIAMS, who runs A Continuous Lean, a men’s style blog, ditched his Timex when he got his first cellphone in 2001.

+
+
+ + +
+

The Collection: A New Fashion App for the iPad

+
The Collection
+

A one-stop destination for Times fashion coverage and the latest from the runways.

+ +
+ +
+
+ +

Follow Us on Twitter

+
NYTimesFashion on Twitter
+

Follow @NYTimesfashion for fashion, beauty and lifestyle news and headlines.

+ +
+ + +
+
+ +
Peter DaSilva for The New York Times
+

ANALOG LOVE Andy Greenblatt of Watchismo, an online retailer that has seen more interest from a generation of men who rely on their  cellphones for the time.

+
+ +
+
+

+Tyler Thoreson, the head of men’s editorial for Gilt Man, the flash sale Web site, often kept his forgettable watches stashed in a drawer.

+And Eddy Chai, an owner of Odin New York, a downtown men’s boutique, gave up wearing watches regularly in his mid-20s, when he outgrew his Casio.

+But after going watch-free for much of the last decade, the three men — all in their 30s and considered style influencers — are turning back time. Mr. Thoreson, 38, is shopping for a vintage gold IWC with a white dial or a Rolex GMT-Master. Mr. Chai, 38, has been wearing a vintage Rolex, loosely dangling around his wrist, “not as a timepiece, but as a piece of jewelry,” he said.

+And Mr. Williams, 32, splurged on three watches: an IWC Portuguese, a Rolex GMT-Master II and an Omega Speedmaster, also known as the “moon watch,” since that is what Apollo astronauts wore.

+“The men’s-wear set has recently rediscovered the joy of proper mechanical timepieces,” Mr. Williams said. “Right now there is no clearer indication of cool than wearing a watch. If it was your grandfather’s bubbleback Rolex, even better.”

+As recently as a half-decade ago, time seemed to be running out for the wristwatch. With cellphones, iPods and other clock-equipped devices becoming ubiquitous, armchair sociologists were writing off the wristwatch as an antique, joining VHS tapes, Walkman players and pocket calculators on the slag heap of outmoded gadgets.

+The wristwatch “may be going the way of the abacus,” declared a news article in The Sacramento Bee in 2006. The Times of London had it “going the same way as the sundial.” The Boston Globe, in a 2005 lifestyle feature, was more definitive: “Anyone who needs to know the time these days would be wise to ask someone over the age of 30. To most young people, the wristwatch is an obsolete artifact.”

+Or, not.

+The “sundial” of the wrist is experiencing an uptick among members of the supposed lost generation, particularly by heritage-macho types in their 20s and 30s who are drawn to the wristwatch’s retro appeal, just as they have seized on straight razors, selvedge denim and vintage vinyl.

+"It’s an understated statement about your station in life, your taste level,” Mr. Thoreson said.

+He got a taste of the pent-up demand last fall, when Gilt organized a high-end vintage watch sale with Benjamin Clymer, 28, who runs an online magazine for watch enthusiasts called Hodinkee.com. (Mr. Clymer, a former UBS manager, said his site attracts 250,000 unique visitors a month, more than half of them under 40.)

+Fourteen of the 17 watches, with an average price of $4,800, sold in the first six hours. Gilt now holds a watch sale every month. “In certain circles,” Mr. Thoreson said, “if you don’t have a substantial timepiece with some pedigree, you feel like you’re missing out on something.”

+To be fair, the doomsayers were not entirely wrong. Few people actually need a watch to tell time anymore. Melanie Shreffler, editor in chief of Ypulse, a Web site and market research company that tracks youth trends, observed, “even the high school and college students who wear watches usually pull out their cellphones to check the time.”

+But that’s the point. A watch these days may strike some people as an impractical, frivolous and often costly way to express individual style. But that is just another way of saying that it’s fashion.

+“Considering how casual most people dress on a day-to-day basis, a glamorous watch is one of the few accessories that can be at once sporty, luxurious and utilitarian,” the designer Michael Kors wrote in an e-mail. Mr. Kors has a line of oversize chronographs, manufactured by Fossil, that is popular among women (they are a current must-have accessory among under-30 fashion assistant types in Manhattan).

+For a generation raised on Game Boys, however, the appeal seems to go a little deeper than just a desire for another fashion accessory. In a world surrounded by ever-glowing LCD screens, there’s an analog chic to wearing a mechanical instrument.

+“A cool machine that is all moving parts has got to be intrinsically interesting to someone born into this generation, because there’s just nothing like that in their life,” said Mitch Greenblatt, a founder, with his brother, Andy, of Watchismo, a California online retailer of design-forward watches.

+
+
+ + +
+ +
+
+ +
+
+
+
+
+
+
    + +
  • +Print +
  • +
  • + Single Page +
  • + + + +
  • + + + + + + + + +
    +Reprints +
  • +
    +
+
+
+
+ +
+
+ + + +
+ +
+
+
+
+
+
+
+
Get Free E-mail Alerts on These Topics
+
+ + + + + +
+
+
+
+ +
+ + + + + +
+
+
+
+ +
+ +
+
+ +
+
+ +
+ + + +
+ +
+
+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+ +
+ +
+

+Advertisements

+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+ + + +
+ +
+
+ +
+
+ + + +
+ +
+ +
+
+ +
+ + + + + + +
+
+ + +
+ +
+ +

+ Inside NYTimes.com

+
+ + +
+ + + + + + + + + + + + + + + + + +
+
+
+ Business » +
+
+ Carriers Warn of Crisis in Mobile Spectrum +
+
Carriers Warn of Crisis in Mobile Spectrum
+
+
+
+
+ Dining & Wine » +
+
+ The Pizza Issue +
+
The Pizza Issue
+
+
+
+
Opinion »
+

Is Veganism For Everyone?

+

It’s a commitment, so Room for Debate asks, does the regimen really have enough benefits to benefit all body types and mindsets?

+
+
+
+
+ World » +
+
+ Shipwreck Cuts Two Ways for Island’s Tourism +
+
Shipwreck Cuts Two Ways for Island’s Tourism
+
+
+
+
+ Opinion »
+
+ Ann Patchett: And the Winner Isn’t ... +
+
Ann Patchett: And the Winner Isn’t ...
+
+
+
+
+ Dining & Wine » +
+
+ Restaurant Review: Alison Eighteen +
+
Restaurant Review: Alison Eighteen
+
+
+
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/test_sample_articles.py b/src/tests/test_sample_articles.py new file mode 100644 index 0000000..a52f5bd --- /dev/null +++ b/src/tests/test_sample_articles.py @@ -0,0 +1,31 @@ +"""Process all of the samples and make sure that process without error.""" +import os +import unittest + +from readability_lxml.readability import Document + + +SAMPLES = os.path.join(os.path.dirname(__file__), 'samples') + +sample_list = [ + 'nyt.sample.html', + 'si-game.sample.html', +] + + +def load_sample(filename): + """Helper to get the content out of the sample files""" + return open(os.path.join(SAMPLES, filename)).read() + + +def test_processes(): + for article in sample_list: + yield process_article, article + + +def process_article(article): + sample = load_sample(article) + doc = Document(sample) + res = doc.summary() + failed_msg = "Failed to process the article: " + article + assert '