# Path: devicecloud/conditions.py
# class Attribute(object):
#     """An attribute is a piece of data on which we may perform comparisons
# 
#     Comparisons performed to attributes will in turn generate new
#     :class:`.Comparison` instances.
#     """
# 
#     def __init__(self, name):
#         self.name = name
# 
#     def __str__(self):
#         return self.name
# 
#     def __gt__(self, value):
#         return Comparison(self, '>', value)
# 
#     def __lt__(self, value):
#         return Comparison(self, '<', value)
# 
#     def __eq__(self, value):
#         return Comparison(self, '=', value)
# 
#     def like(self, value):
#         return Comparison(self, ' like ', value)


import unittest
import datetime
from devicecloud.conditions import Attribute
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2015-2018 Digi International Inc. All rights reserved.




class TestConditions(unittest.TestCase):

    def test_gt(self):
        a = Attribute("a")
        self.assertEqual((a > 21).compile(), "a>'21'")

    def test_lt(self):
        a = Attribute("a")
        self.assertEqual((a < 25).compile(), "a<'25'")

    def test_eq(self):
        a = Attribute("a")
        self.assertEqual((a == "a string").compile(), "a='a string'")

    def test_like(self):
        a = Attribute("a")
        self.assertEqual(a.like(r"%.txt").compile(), "a like '%.txt'")

    def test_and(self):
        a = Attribute("a")

# Path: devicecloud/conditions.py
# class Attribute(object):
#     """An attribute is a piece of data on which we may perform comparisons
# 
#     Comparisons performed to attributes will in turn generate new
#     :class:`.Comparison` instances.
#     """
# 
#     def __init__(self, name):
#         self.name = name
# 
#     def __str__(self):
#         return self.name
# 
#     def __gt__(self, value):
#         return Comparison(self, '>', value)
# 
#     def __lt__(self, value):
#         return Comparison(self, '<', value)
# 
#     def __eq__(self, value):
#         return Comparison(self, '=', value)
# 
#     def like(self, value):
#         return Comparison(self, ' like ', value)


# Path: devicecloud/test/unit/test_conditions.py
import unittest
import datetime
from devicecloud.conditions import Attribute

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2015-2018 Digi International Inc. All rights reserved.




class TestConditions(unittest.TestCase):

    def test_gt(self):
        a = Attribute("a")
        self.assertEqual((a > 21).compile(), "a>'21'")

    def test_lt(self):
        a = Attribute("a")
        self.assertEqual((a < 25).compile(), "a<'25'")

    def test_eq(self):
        a = Attribute("a")
        self.assertEqual((a == "a string").compile(), "a='a string'")

    def test_like(self):
        a = Attribute("a")
        self.assertEqual(a.like(r"%.txt").compile(), "a like '%.txt'")

    def test_and(self):
        a = Attribute("a")

        b = Attribute("b")