summaryrefslogtreecommitdiff
path: root/scss/tests
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2014-08-27 14:56:41 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2014-08-27 14:56:41 -0700
commit11e2b44c0e7992db0e339f4dd53fe93a16710802 (patch)
tree26be7ac1067fae42bfa5eff3f37a08d267e47c71 /scss/tests
parent6a8efa934d9a91c0916ecbc6659f275e25858bc6 (diff)
downloadpyscss-11e2b44c0e7992db0e339f4dd53fe93a16710802.tar.gz
Introduce an Extension class, finally. Making a stab at #130.
All the core functions have been moved into a core Extension, and Namespace has been beefed up a little bit so declaring functions is easy.
Diffstat (limited to 'scss/tests')
-rw-r--r--scss/tests/functions/test_core.py6
-rw-r--r--scss/tests/test_expression.py7
2 files changed, 5 insertions, 8 deletions
diff --git a/scss/tests/functions/test_core.py b/scss/tests/functions/test_core.py
index a16b447..1d7c64d 100644
--- a/scss/tests/functions/test_core.py
+++ b/scss/tests/functions/test_core.py
@@ -7,9 +7,8 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
+from scss.core import CoreExtension
from scss.expression import Calculator
-from scss.functions.core import CORE_LIBRARY
-from scss.rule import Namespace
from scss.types import Color, Number, String
import pytest
@@ -20,8 +19,7 @@ xfail = pytest.mark.xfail
@pytest.fixture
def calc():
- ns = Namespace(functions=CORE_LIBRARY)
- return Calculator(ns).evaluate_expression
+ return Calculator(CoreExtension.namespace).evaluate_expression
# ------------------------------------------------------------------------------
diff --git a/scss/tests/test_expression.py b/scss/tests/test_expression.py
index 8c7a82a..0c607da 100644
--- a/scss/tests/test_expression.py
+++ b/scss/tests/test_expression.py
@@ -4,9 +4,9 @@ contains a variety of expression-related tests.
from __future__ import absolute_import
from __future__ import unicode_literals
+from scss.core import CoreExtension
from scss.errors import SassEvaluationError
from scss.expression import Calculator
-from scss.functions.core import CORE_LIBRARY
from scss.rule import Namespace
from scss.types import Color, List, Null, Number, String
@@ -33,7 +33,7 @@ def test_reference_operations():
# Need to build the calculator manually to get at its namespace, and need
# to use calculate() instead of evaluate_expression() so interpolation
# works
- ns = Namespace(functions=CORE_LIBRARY)
+ ns = CoreExtension.namespace.derive()
calc = Calculator(ns).calculate
# Simple example
@@ -81,8 +81,7 @@ def test_parse(calc):
def test_functions(calc):
- ns = Namespace(functions=CORE_LIBRARY)
- calc = Calculator(ns).calculate
+ calc = Calculator(CoreExtension.namespace).calculate
assert calc('grayscale(red)') == Color.from_rgb(0.5, 0.5, 0.5)
assert calc('grayscale(1)') == String('grayscale(1)', quotes=None) # Misusing css built-in functions (with scss counterpart)