<reponame>rphilander/proteus
import unittest

from atom import Atom


class AtomTests(unittest.TestCase):

    def test_accessors(self):
        atom = Atom('foo', 'bar', True)
        self.assertEqual(atom.get_type(), 'foo')
        self.assertEqual(atom.get_value(), 'bar')
        self.assertEqual(atom.get_stopword(), True)

    def test_accessors_default_stopword(self):
        atom = Atom('foo', 'bar')
        self.assertEqual(atom.get_type(), 'foo')
        self.assertEqual(atom.get_value(), 'bar')
        self.assertEqual(atom.get_stopword(), False)

    def test_clone_nonstopword(self):
        atom = Atom('foo', 'bar', True)
        cloned_atom = atom.clone_nonstopword()
        self.assertEqual(cloned_atom.get_stopword(), False)

    def test_equal(self):
        lhs = Atom('foo', 'bar', 0)
        rhs = Atom('foo', 'bar', 1)
        self.assertEqual(lhs, rhs)

    def test_notequal(self):
        lhs = Atom('foo', 'bar', 0)
        rhs = Atom('foo', 'baz', 1)
        self.assertNotEqual(lhs, rhs)

    def test_notimplemented(self):
        lhs = Atom('foo', 'bar', 0)
        rhs = 'this is not an atom'
        with self.assertRaises(NotImplementedError):
            boo = (lhs == rhs)
            

if __name__ == '__main__':
    unittest.main()

import unittest

from atom import Atom


class AtomTests(unittest.TestCase):

    def test_accessors(self):
        atom = Atom('foo', 'bar', True)
        self.assertEqual(atom.get_type(), 'foo')
        self.assertEqual(atom.get_value(), 'bar')
        self.assertEqual(atom.get_stopword(), True)

    def test_accessors_default_stopword(self):
        atom = Atom('foo', 'bar')
        self.assertEqual(atom.get_type(), 'foo')
        self.assertEqual(atom.get_value(), 'bar')
        self.assertEqual(atom.get_stopword(), False)

    def test_clone_nonstopword(self):
        atom = Atom('foo', 'bar', True)
        cloned_atom = atom.clone_nonstopword()
        self.assertEqual(cloned_atom.get_stopword(), False)

    def test_equal(self):
        lhs = Atom('foo', 'bar', 0)
        rhs = Atom('foo', 'bar', 1)
        self.assertEqual(lhs, rhs)

    def test_notequal(self):
        lhs = Atom('foo', 'bar', 0)
        rhs = Atom('foo', 'baz', 1)
        self.assertNotEqual(lhs, rhs)

    def test_notimplemented(self):
        lhs = Atom('foo', 'bar', 0)
        rhs = 'this is not an atom'
        with self.assertRaises(NotImplementedError):
            boo = (lhs == rhs)
            

if __name__ == '__main__':
    unittest.main()