from symengine.utilities import raises

from symengine import symbols, DictBasic, sin

def test_DictBasic():
    x, y, z = symbols("x y z")
    d = DictBasic({x : 2, y: z})

    assert str(d) == "{x: 2, y: z}"
    assert d[x] == 2

    raises(KeyError, lambda: d[2*z])
    if 2*z in d:
        assert False

    d[2*z] = x
    assert d[2*z] == x
    if 2*z not in d:
        assert False
    assert set(d.items()) == set([(2*z, x), (x, 2), (y, z)])

    del d[x]
    assert set(d.keys()) == set([2*z, y])
    assert set(d.values()) == set([x, z])

    e = y + sin(2*z)
    assert e.subs(d) == z + sin(x)
@@ -78,16 +78,25 @@
 sic, sin
+, Integer
 %0A%0Adef te
@@ -162,17 +162,16 @@
 Basic(%7Bx
- 
 : 2, y: 
@@ -210,16 +210,44 @@
 , y: z%7D%22
+ or str(d) == %22%7By: z, x: 2%7D%22
 %0A    ass
@@ -465,17 +465,26 @@
 x), (x, 
-2
+Integer(2)
 ), (y, z

Fix tests in MSVC