def test_get_variables(self): self.assertSetEqual( OrStatement([ VariableStatement('foo'), VariableStatement('foo'), VariableStatement('bar'), TrueStatement() ]).get_variables(), {'foo', 'bar'})
def test_str(self): self.assertEqual( OrStatement([ VariableStatement('foo'), VariableStatement('foo'), VariableStatement('bar'), TrueStatement() ]).__str__(), "(foo | foo | bar | 1)")
def test_get_variables(self): self.assertSetEqual( XnorStatement(VariableStatement('foo'), VariableStatement('bar')).get_variables(), {'foo', 'bar'}) self.assertSetEqual( XnorStatement(VariableStatement('foo'), VariableStatement('foo')).get_variables(), {'foo'})
def test_str(self): self.assertEqual( AndStatement([ VariableStatement('foo'), VariableStatement('foo'), VariableStatement('bar'), TrueStatement() ]).__str__(), "(foo & foo & bar & 1)")
def test_str(self): self.assertEqual(VariableStatement('foo').__str__(), 'foo')
def test_evaluate(self): self.assertTrue(VariableStatement('foo').evaluate({'foo': True})) self.assertFalse(VariableStatement('bar').evaluate({'bar': False})) self.assertRaises( MissingVariableException, lambda: VariableStatement('foo').evaluate({'bar': False}))
def test_get_variables(self): self.assertSetEqual(VariableStatement('foo').get_variables(), {'foo'})
def test_str(self): self.assertEqual( NotStatement(VariableStatement('foo')).__str__(), "~foo")
def test_str(self): self.assertEqual( XnorStatement(VariableStatement('foo'), FalseStatement()).__str__(), "(foo = 0)")