예제 #1
0
파일: date.py 프로젝트: Bicker/pyquest
    def __eq__(self, other):
        if isinstance(other, QLDate):
            return QLBoolean(self.day == other.day
                             and self.month == other.month
                             and self.year == other.year)

        return QLBoolean(False)
예제 #2
0
    def test_file(self, file):
        ast = self.__parser.parse(file, self.__lexer.lexer)

        if not self.__parser.errors:
            TypeVisitor(extract_identifier_types(ast)).visit(ast)
            model = extract_gui_model(ast)
            result_type, result_value = file.split('\n')[0].split()[-2:]
            correct_result = None

            if result_type == 'QLBoolean' and result_value == 'True':
                correct_result = QLBoolean(True)
            elif result_type == 'QLBoolean':
                correct_result = QLBoolean()
            elif result_type == 'QLDate':
                day, month, year = loads(result_value)
                correct_result = QLDate(day, month, year)
            elif result_type == 'QLDecimal':
                correct_result = QLDecimal(result_value)
            elif result_type == 'QLInteger':
                correct_result = QLInteger(result_value)
            elif result_type == 'QLMoney':
                correct_result = QLMoney(result_value)
            elif result_type == 'QLString':
                correct_result = QLString(result_value)

            expression_evaluator = ExpressionEvaluator(model)
            expression_evaluator.visit(ast.block[0].answer)
            return bool(expression_evaluator.result == correct_result)
예제 #3
0
 def __ne__(self, other):
     return QLBoolean(not self == other)
예제 #4
0
    def __eq__(self, other):
        if isinstance(other, QLInteger):
            return QLBoolean(self.value == other.value)

        return QLBoolean(False)
예제 #5
0
파일: string.py 프로젝트: Bicker/pyquest
 def __ge__(self, other):
     return QLBoolean(len(self.value) >= len(other.value))
예제 #6
0
파일: string.py 프로젝트: Bicker/pyquest
 def __lt__(self, other):
     return QLBoolean(len(self.value) < len(other.value))
예제 #7
0
 def __init__(self):
     self.form = None
     self.condition = QLBoolean.get_literal_node(True)
예제 #8
0
파일: money.py 프로젝트: Bicker/pyquest
 def __ge__(self, other):
     return QLBoolean(self.value >= other.value
                      and self.currency == other.currency)
예제 #9
0
파일: date.py 프로젝트: Bicker/pyquest
 def __ge__(self, other):
     return QLBoolean(self > other or self == other)
예제 #10
0
파일: date.py 프로젝트: Bicker/pyquest
 def __le__(self, other):
     return QLBoolean(self < other or self == other)
예제 #11
0
파일: date.py 프로젝트: Bicker/pyquest
 def __gt__(self, other):
     return QLBoolean(self.year > other.year or
                      (self.month > other.month and self.year == other.year)
                      or (self.day > other.day and self.month == other.month
                          and self.year == other.year))
예제 #12
0
파일: date.py 프로젝트: Bicker/pyquest
 def __lt__(self, other):
     return QLBoolean(self.year < other.year or
                      (self.month < other.month and self.year == other.year)
                      or (self.day < other.day and self.month == other.month
                          and self.year == other.year))
예제 #13
0
 def evaluate(self):
     self.value = QLBoolean(not self.expression.value)
예제 #14
0
 def __le__(self, other):
     return QLBoolean(self.value <= other.value)
예제 #15
0
파일: parser.py 프로젝트: Bicker/pyquest
 def p_boolean_literal(production):
     """expression   : FALSE
                     | TRUE"""
     production[0] = BooleanNode(Metadata(production.lineno(1)), QLBoolean,
                                 QLBoolean(production[1]))
예제 #16
0
 def __ge__(self, other):
     return QLBoolean(self.value >= other.value)
예제 #17
0
파일: money.py 프로젝트: Bicker/pyquest
    def __eq__(self, other):
        if isinstance(other, QLMoney):
            return QLBoolean(self.value == other.value
                             and self.currency == other.currency)

        return QLBoolean(False)