Commits

masklinn committed 87e9773

Add support for informally deprecated <> operator, fixes #9

  • Participants
  • Parent commits 9623ccc

Comments (0)

Files changed (2)

     var PY_operators = {
         '==': ['eq', 'eq', function (a, b) { return a === b; }],
         '!=': ['ne', 'ne', function (a, b) { return a !== b; }],
+        '<>': ['ne', 'ne', function (a, b) { return a !== b; }],
         '<': ['lt', 'gt', function (a, b) {return a.constructor.name < b.constructor.name;}],
         '<=': ['le', 'ge', function (a, b) {return a.constructor.name <= b.constructor.name;}],
         '>': ['gt', 'lt', function (a, b) {return a.constructor.name > b.constructor.name;}],
             return b.__contains__(a);
         case 'not in':
             return b.__contains__(a) === py.True ? py.False : py.True;
-        case '==': case '!=':
+        case '==': case '!=': case '<>':
         case '<': case '<=':
         case '>': case '>=':
             return PY_op(a, b, operator);
             expect(py.eval('foo != bar', {foo: 'qux', bar: 'quux'}))
                 .to.be(true);
         });
+        it('should accept deprecated form', function () {
+            expect(py.eval('1 <> 2')).to.be(true);
+            expect(py.eval('"foo" <> "foo"')).to.be(false);
+            expect(py.eval('"foo" <> "bar"')).to.be(true);
+        });
     });
     describe('rich comparisons', function () {
         it('should work with numbers', function () {