"""Various tests of type safety."""
import unittest

from raco.fakedb import FakeDatabase
from raco.scheme import Scheme
from raco.myrial.myrial_test import MyrialTestCase
from collections import Counter


class TypeTests(MyrialTestCase):
    schema = Scheme(
        [("clong", "LONG_TYPE"),
         ("cint", "INT_TYPE"),
         ("cstring", "STRING_TYPE"),
         ("cfloat", "DOUBLE_TYPE")])

    def setUp(self):
        super(TypeTests, self).setUp()
        self.db.ingest("public:adhoc:mytable", Counter(), TypeTests.schema)

    def noop_test(self):
        query = """
        X = SCAN(public:adhoc:mytable);
        STORE(X, OUTPUT);
        """

        self.check_scheme(query, TypeTests.schema)

@@ -161,24 +161,72 @@
 ialTestCase%0A
+from raco.expression import TypeSafetyViolation%0A
 from collect
@@ -732,28 +732,280 @@
 me(query, TypeTests.schema)%0A
+%0A    def invalid_eq(self):%0A        query = %22%22%22%0A        X = %5BFROM SCAN(public:adhoc:mytable) AS X EMIT clong=cstring%5D;%0A        STORE(X, OUTPUT);%0A        %22%22%22%0A        with self.assertRaises(TypeSafetyViolation):%0A            self.check_scheme(query, None)%0A

Test of invalid equality test