diff options
author | Eevee <eevee.git@veekun.com> | 2013-06-28 13:51:59 -0700 |
---|---|---|
committer | Eevee <eevee.git@veekun.com> | 2013-06-28 13:51:59 -0700 |
commit | 60e0e5725dd4c320a3f44f9af2e43807529887d2 (patch) | |
tree | 62a4670d897abcf5a64ba9494d428e98807f4481 | |
parent | 1b9e6b01d0a7400117aabeb548a328cf1624a333 (diff) | |
download | pyscss-60e0e5725dd4c320a3f44f9af2e43807529887d2.tar.gz |
Test for null equality; fix null repr.
-rw-r--r-- | scss/tests/test_expression.py | 12 | ||||
-rw-r--r-- | scss/types.py | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/scss/tests/test_expression.py b/scss/tests/test_expression.py index c1084c3..ace113b 100644 --- a/scss/tests/test_expression.py +++ b/scss/tests/test_expression.py @@ -112,6 +112,9 @@ def test_comparison_stringerific(): assert not calc('"abc" != "abc"') assert not calc('"abc" == "xyz"') + # Interaction with other types + assert calc('123 != "123"') + # Sass strings don't support ordering for expression in ( '"abc" < "xyz"', @@ -124,6 +127,15 @@ def test_comparison_stringerific(): with pytest.raises(TypeError): calc(expression) +def test_comparison_null(): + calc = Calculator(Namespace()).calculate + + assert calc('null == null') + assert calc('null != 0') + + with pytest.raises(TypeError): + calc('null < null') + # TODO write more! i'm lazy. diff --git a/scss/types.py b/scss/types.py index 35a9691..0314ce6 100644 --- a/scss/types.py +++ b/scss/types.py @@ -91,6 +91,9 @@ class NullValue(Value): def __str__(self): return 'null' + def __repr__(self): + return "<%s>" % (type(self).__name__,) + def __nonzero__(self): return False |