Skip to content

Commit 80bb9de

Browse files
author
Matthew Peters
committed
Use nose for tests
1 parent b04bd78 commit 80bb9de

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ dragnet/readability.cpp
1616
documents/*
1717
output/*
1818

19+
.coverage
20+
1921
# vim temp files
2022
*.swp
2123

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ clean:
99
# lcs.cpp and blocks.cpp are generated by cython
1010
rm -rf build dist dragnet/*.pyc dragnet/*.so dragnet/lcs.cpp dragnet/blocks.cpp dragnet.egg-info
1111

12-
test: unittest
12+
test: nose
13+
14+
nose:
15+
nosetests --exe --cover-package=dragnet --with-coverage --cover-branches -v --cover-erase
1316

1417
unittest:
1518
python -m unittest discover -s test

dragnet/content_extraction_model.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def analyze(self, s, blocks=False, encoding=None, parse_callback=None):
7575
return self.analyze_from_blocks(blocks_, return_blocks=blocks)
7676

7777
def analyze_from_blocks(self, blocks, return_blocks=False):
78-
# 2. - make features
78+
# make features
7979
features = self.make_features_from_blocks(blocks)
8080

81-
# 3/4 - run model and select results
81+
# run model and select results
8282
if features is not None:
8383
content_mask = self._block_model.predict(features) > self._threshold
8484
results = [ele[0] for ele in zip(blocks, content_mask) if ele[1]]
@@ -113,13 +113,12 @@ def make_features(self, s, train=False, encoding=None, parse_callback=None):
113113
raises BlockifyError if there is an error parsing the doc
114114
and None if doc is too short (< 3 blocks)
115115
116-
train = if true, then passes it into feature maker"""
117-
# note: this method isn't needed by ContentExtractionModel anymore
118-
# but is kept for now for backward compatibilty with training
119-
# code
116+
train = if true, then passes it into feature maker
117+
"""
118+
# note: this method is not longer needed by ContentExtractionModel
119+
# but is kept for now for backward compatibilty with training code
120120
blocks = self._blockifier.blockify(s, encoding=encoding,
121121
parse_callback=parse_callback)
122-
123122
return self.make_features_from_blocks(blocks, train), blocks
124123

125124
@staticmethod

0 commit comments

Comments
 (0)