Skip to content

Commit cde3dfa

Browse files
authored
Merge pull request #300 from KnowledgeCaptureAndDiscovery/dev
Dev
2 parents afe6514 + c6cf0d9 commit cde3dfa

File tree

1 file changed

+76
-76
lines changed

1 file changed

+76
-76
lines changed

src/somef/test/test_header_analysis.py

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,35 @@ class TestAlmostEqual(unittest.TestCase):
66

77
def test_extract_header_content_hash(self):
88
text = """
9-
# First level header
10-
Content first header
11-
# Empty header (should not be counted, as there is no content)
12-
## Second level header
13-
Content second header
14-
### Third level header
15-
Content third header
16-
#### Fourth level header
17-
Content fourth header
18-
##### Fifth level header
19-
Content fifth header
20-
###### Sixth level header
21-
Content sixth header
9+
# First level header
10+
Content first header
11+
# Empty header (should not be counted, as there is no content)
12+
## Second level header
13+
Content second header
14+
### Third level header
15+
Content third header
16+
#### Fourth level header
17+
Content fourth header
18+
##### Fifth level header
19+
Content fifth header
20+
###### Sixth level header
21+
Content sixth header
2222
"""
2323
result = extract_header_content(text)
2424
print(result)
2525
assert len(result.index) == 6
2626

2727
def test_extract_header_content_hash_complex(self):
2828
text = """
29-
First level header
30-
==================
31-
Content first header
32-
## Second level header ##
33-
Content second header
34-
### Third level header ###
35-
Content third header
29+
First level header
30+
==================
31+
Content first header
32+
## Second level header ##
33+
34+
Content second header
35+
### Third level header ###
36+
37+
Content third header
3638
"""
3739
result = extract_header_content(text)
3840
print(result)
@@ -42,24 +44,24 @@ def test_extract_header_content_hash_complex(self):
4244
# Example: Taguette
4345
def test_extract_header_content_underline(self):
4446
text = """
45-
Heading level 1
46-
===============
47-
This is a first level header
48-
49-
Empty level header
50-
=================
51-
52-
Heading level 2
53-
---------------
54-
Content for heading 2
55-
56-
Empty Heading level 2
57-
---------------------
58-
59-
Heading level 1 with incomplete sub
60-
===
61-
Content from incomplete
62-
47+
Heading level 1
48+
===============
49+
This is a first level header
50+
51+
Empty level header
52+
=================
53+
54+
Heading level 2
55+
---------------
56+
Content for heading 2
57+
58+
Empty Heading level 2
59+
---------------------
60+
61+
Heading level 1 with incomplete sub
62+
===
63+
Content from incomplete
64+
6365
"""
6466
result = extract_header_content(text)
6567
print(result)
@@ -76,55 +78,53 @@ def test_extract_categories_using_headers(self):
7678

7779
def test_extract_bash_code(self):
7880
text = """Another solution is to run Node directly with the `--max-old-space-size` option. The following example (Mac or Linux) allocates 16GB of memory:
79-
```bash
80-
$ node --max-old-space-size=16000 `which mapshaper` <mapshaper commands>
81-
```
82-
83-
## Installation
84-
85-
Mapshaper requires [Node.js](http://nodejs.org).
86-
87-
With Node installed, you can install the latest release version of mapshaper using npm. Install with the "-g" flag to make the executable scripts available systemwide.
88-
89-
```bash
90-
npm install -g mapshaper
91-
```
92-
93-
To install and run the latest development code from github:
94-
95-
```bash
96-
git clone git@github.com:mbloch/mapshaper.git
97-
cd mapshaper
98-
npm install # install dependencies
99-
npm run build # bundle source code files
100-
npm link # (optional) add global symlinks so scripts are available systemwide
101-
```
102-
103-
## Building and testing
104-
105-
From the project directory, run `npm run build` to build both the cli and web UI modules.
106-
107-
Run `npm test` to run mapshaper's tests.
108-
109-
## License
110-
111-
This software is licensed under [MPL 2.0](http://www.mozilla.org/MPL/2.0/).
112-
113-
According to Mozilla's [FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html), "The MPL's ‘file-level’ copyleft is designed to encourage contributors to share modifications they make to your code, while still allowing them to combine your code with code under other licenses (open or proprietary) with minimal restrictions."" \
114-
"""
81+
```bash
82+
$ node --max-old-space-size=16000 `which mapshaper` <mapshaper commands>
83+
```
84+
85+
## Installation
86+
87+
Mapshaper requires [Node.js](http://nodejs.org).
88+
89+
With Node installed, you can install the latest release version of mapshaper using npm. Install with the "-g" flag to make the executable scripts available systemwide.
90+
91+
```bash
92+
npm install -g mapshaper
93+
```
94+
95+
To install and run the latest development code from github:
96+
97+
```bash
98+
git clone git@github.com:mbloch/mapshaper.git
99+
cd mapshaper
100+
npm install # install dependencies
101+
npm run build # bundle source code files
102+
npm link # (optional) add global symlinks so scripts are available systemwide
103+
```
104+
105+
## Building and testing
106+
107+
From the project directory, run `npm run build` to build both the cli and web UI modules.
108+
109+
Run `npm test` to run mapshaper's tests.
110+
111+
## License
112+
113+
This software is licensed under [MPL 2.0](http://www.mozilla.org/MPL/2.0/).
114+
115+
According to Mozilla's [FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html), "The MPL's ‘file-level’ copyleft is designed to encourage contributors to share modifications they make to your code, while still allowing them to combine your code with code under other licenses (open or proprietary) with minimal restrictions."" \
116+
"""
115117
output = extract_bash_code(text)
116118
assert len(output) == 3
117119

118120
def test_issue_232(self):
119121
with open("pyansys-README.rst", "r") as data_file:
120122
file_text = data_file.read()
121123
results = extract_header_content(file_text)
122-
# At least 5 categories are extracted from the header analysis
123124
print(results)
124125
assert len(results) == 8
125126
with open("rasterio-README.md", "r") as data_file:
126127
file_text = data_file.read()
127128
results = extract_header_content(file_text)
128-
# At least 5 categories are extracted from the header analysis
129129
print(results)
130130
assert len(results) == 17

0 commit comments

Comments
 (0)