#!/usr/bin/env python
import coral
DI = coral.lang.XMIDI20

d=DI.Diagram()
d.zoom=100.0

print d.zoom

assert str(d.zoom)=="100"

# This works but it is weird
print  int(float(d.zoom))

print d.zoom.__int__()
print int(d.zoom)

d.zoom += 3
assert isinstance(d.zoom, coral.ElementPrimitive)
print float(d.zoom)
assert d.zoom - 103.0 == 0

d.zoom -= 3
assert isinstance(d.zoom, coral.ElementPrimitive)
print float(d.zoom)
assert d.zoom - 100.0 == 0


assert d.zoom + 1 == 101.0   #__add__(  	self, other)
assert d.zoom - 1 == 99.0   #__sub__( 	self, other)
assert d.zoom * 2 == 200.0   #__mul__( 	self, other)
###assert d.zoom ==    #__floordiv__( 	self, other)
assert d.zoom % 9 == 1   #__mod__( 	self, other)
###assert d.zoom ==    #__divmod__( 	self, other)
###assert d.zoom ==    #__pow__( 	self, other[, modulo])
###assert d.zoom ==    #__lshift__( 	self, other)
###assert d.zoom ==    #__rshift__( 	self, other)
###assert d.zoom ==    #__and__( 	self, other)
###assert d.zoom ==    #__xor__( 	self, other)
###assert d.zoom ==    #__or__( 	self, other)
assert d.zoom / 3 == 100.0 / 3   #__div__( 	self, other)
assert d.zoom // 2 == 50.0   #__floordiv__( 	self, other)

assert 1 + d.zoom == 101.0   #__radd__( 	self, other)
assert 1 - d.zoom == -99.0   #__rsub__( 	self, other)
assert 2 * d.zoom == 200.0   #__rmul__( 	self, other)
assert 300 / d.zoom == 3.0   #__rdiv__( 	self, other)
###assert d.zoom ==    #__rtruediv__( 	self, other)
assert 1007 // d.zoom == 10   #__rfloordiv__( 	self, other)
###assert d.zoom ==    #__rmod__( 	self, other)
###assert d.zoom ==    #__rdivmod__( 	self, other)
###assert d.zoom ==    #__rpow__( 	self, other)
###assert d.zoom ==    #__rlshift__( 	self, other)
###assert d.zoom ==    #__rrshift__( 	self, other)
###assert d.zoom ==    #__rand__( 	self, other)
###assert d.zoom ==    #__rxor__( 	self, other)
###assert d.zoom ==    #__ror__( 	self, other)

#assert d.zoom ==    #__iadd__( 	self, other)
#assert d.zoom ==    #__isub__( 	self, other)
#assert d.zoom ==    #__imul__( 	self, other)
#assert d.zoom ==    #__idiv__( 	self, other)

###assert d.zoom ==    #__itruediv__( 	self, other)
###assert d.zoom ==    #__ifloordiv__( 	self, other)
###assert d.zoom ==    #__imod__( 	self, other)
###assert d.zoom ==    #__ipow__( 	self, other[, modulo])
###assert d.zoom ==    #__ilshift__( 	self, other)
###assert d.zoom ==    #__irshift__( 	self, other)
###assert d.zoom ==    #__iand__( 	self, other)
###assert d.zoom ==    #__ixor__( 	self, other)
###assert d.zoom ==    #__ior__( 	self, other)

assert -d.zoom == -100.0   #__neg__( 	self)
assert +d.zoom == 100.0   #__pos__( 	self)
assert abs(d.zoom) == 100.0   #__abs__( 	self)
###assert d.zoom ==    #__invert__( 	self)

###assert d.zoom ==    #__complex__( 	self)
assert int(d.zoom) == 100   #__int__( 	self)
assert long(d.zoom) == 100   #__long__( 	self)
assert float(d.zoom) == 100.0   #__float__( 	self)

###assert d.zoom ==    #__oct__( 	self)
###assert d.zoom ==    #__hex__( 	self)
