-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a unit test to make sure each <article> has tab-pane and active
- Loading branch information
1 parent
e732111
commit 08894f5
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import unittest | ||
from bs4 import BeautifulSoup | ||
import os | ||
from pathlib import Path | ||
from git_root import git_root | ||
|
||
class beautifulSoupTests(unittest.TestCase): | ||
""" | ||
This test sets up a bs4 (https://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-beautiful-soup) | ||
runner for tests of index.md that do not require a web browser. | ||
""" | ||
|
||
#https://github.com/jtilly/git_root | ||
soup = BeautifulSoup("", 'html.parser') | ||
def setUp(self): | ||
with open(Path(git_root()) / 'index.md', "r") as index: | ||
indexpage = index.read() | ||
self.soup = BeautifulSoup(indexpage , 'html.parser') | ||
|
||
def test_for_active_css_in_tabs(self): | ||
""" | ||
As per https://github.com/carpentries/workshop-template/pull/573/files | ||
all tab divs need to have the active class in index.md | ||
""" | ||
for article in self.soup.find_all("article"): | ||
self.assertIn('active', article['class']) | ||
self.assertIn('tab-pane', article['class']) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
PyYAML | ||
beautifulsoup4 | ||
git_root |