mrmazzone / html-css-grade Goto Github PK
View Code? Open in Web Editor NEWAutograder helper Python lib for easy HTML and CSS checks
Autograder helper Python lib for easy HTML and CSS checks
Issue with some CSS checks is the logging in cssutils. Need to add:
import logging
logging.basicConfig(filename="newfile.log",
format='%(asctime)s %(message)s',
filemode='w')
newlog = logging.getLogger()
cssutils.log.setLog(newlog)
To not send logs to stderr
Request to support methods like:
learner_html.get_element_attribute("source", "srcset”)
To get element values to run checks in plain Python.
Code with comments like this:
/* Styling for the morning and afternoon session titles */
.morn, .noon {
background-color: #bd94ff;
padding-left: 0.5em;
font-size: 16px;
font-weight: bold;
margin-top: 0px;
box-sizing: border-box;
border-collapse: separate;
text-indent: initial;
border-spacing: 2px;
}
/* General styling for the table */
table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
Mess with properly running tests as the comment object does not have selectorTest
and other attributes.
Thank you for your efforts with this code it is very useful.
I do get an error with learner_html.check_HTML whenever I use it irrespective of the string I pass.
learner_html.check_HTML("p")
will produce the following error
`test_check_html (coding_rooms_unit_tests.CodingRoomsUnitTests) ... True
ERROR
Traceback (most recent call last):
File "/usercode/coding_rooms_unit_tests.py", line 10, in test_check_html
print(learner_html.check_HTML("p"))
File "/usr/lib/python3/dist-packages/htmlcssgrade.py", line 50, in check_HTML
return (code_snip.casefold().replace(" ", "").replace("\n", "") in str(self.html_obj.contents[2]).casefold().replace(" ", "").replace("\n", ""))
IndexError: list index out of range
Ran 1 test in 0.001s
FAILED (errors=1)`
my code is
`import unittest
import htmlcssgrade
class CodingRoomsUnitTests(unittest.TestCase):
def test_check_html(self):
learner_html = htmlcssgrade.HTML_Check("index.html")
print(learner_html.check_element_used("p"))
print(learner_html.check_HTML("p"))`
any help would be much appreciated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.