Kaydet (Commit) 8ec176b2 authored tarafından Batuhan Osman TASKAYA's avatar Batuhan Osman TASKAYA

fix the test

üst cec23454
......@@ -4,7 +4,7 @@ pipeline {
stage('prepare') {
steps {
sh 'python -m venv .venv'
sh """. .venv/bin/activate
sh """. .venv/bin/activate
pip install pytest twine mypy flake8 mccabe flake8-junit-report
pip install -e ."""
}
......@@ -62,6 +62,7 @@ pipeline {
}
post {
always {
sh 'cat test_*.xml'
junit 'test_*.xml'
}
}
......
import unittest
from darwcss.darwcss import ColorValue, render
from darwcss.darwcss import ColorValue, ColorTypes, render
class TestColorValue(unittest.TestCase):
def test_output_rgb(self):
red = ColorValue(255, 0, 0)
blue = ColorValue(0, 0, 255, "rgb")
blue = ColorValue(0, 0, 255, ColorTypes.RGB)
self.assertEqual(render(red), "rgb(255, 0, 0)")
self.assertEqual(render(blue), "rgb(0, 0, 255)")
def test_output_hex(self):
purple = ColorValue("fa", "ff", "ca", "hex")
purple = ColorValue("fa", "ff", "ca", ColorTypes.HEX)
self.assertEqual(render(purple), "#faffca")
......
......@@ -11,9 +11,12 @@ class TestMisc(unittest.TestCase):
border_style = Style("border", border_size + border_type + border_color)
self.assertEqual(border_style.value, "5px solid rgb(255, 0, 0)")
def test_numeric_plus_color(self):
self.assertEqual(NumericValue(15, "%") + ColorValue("ff","ff","ff","hex"), "15% #ffffff")
self.assertEqual(
NumericValue(15, "%") + ColorValue("ff", "ff", "ff", ColorTypes.HEX),
"15% #ffffff",
)
if __name__ == "__main__":
unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment