Exemple #1
0
    def test_get_method_return_attributes(self):
        fluent = Fluent(name='john')

        self.assertEqual('john', fluent.get('name'))
        self.assertEqual('default', fluent.get('foo', 'default'))
        self.assertEqual('john', fluent.name)
        self.assertEqual(None, fluent.foo)
Exemple #2
0
    def test_get_method_return_attributes(self):
        fluent = Fluent(name='john')

        self.assertEqual('john', fluent.get('name'))
        self.assertEqual('default', fluent.get('foo', 'default'))
        self.assertEqual('john', fluent.name)
        self.assertEqual(None, fluent.foo)
Exemple #3
0
    def test_get_method_return_attributes(self):
        fluent = Fluent(name="john")

        self.assertEqual("john", fluent.get("name"))
        self.assertEqual("default", fluent.get("foo", "default"))
        self.assertEqual("john", fluent.name)
        self.assertEqual(None, fluent.foo)
Exemple #4
0
    def test_chained_attributes(self):
        fluent = Fluent()
        fluent.unsigned = False

        fluent.integer('status').unsigned()

        self.assertEqual('status', fluent.integer)
        self.assertTrue(fluent.unsigned)
Exemple #5
0
    def test_chained_attributes(self):
        fluent = Fluent()
        fluent.unsigned = False

        fluent.integer('status').unsigned()

        self.assertEqual('status', fluent.integer)
        self.assertTrue(fluent.unsigned)
Exemple #6
0
    def test_set_attributes(self):
        fluent = Fluent()

        fluent.name = 'john'
        fluent.developer()
        fluent.age(25)

        self.assertEqual('john', fluent.name)
        self.assertTrue(fluent.developer)
        self.assertEqual(25, fluent.age)

        self.assertEqual({'name': 'john', 'developer': True, 'age': 25}, fluent.get_attributes())
Exemple #7
0
    def test_set_attributes(self):
        fluent = Fluent()

        fluent.name = 'john'
        fluent.developer()
        fluent.age(25)

        self.assertEqual('john', fluent.name)
        self.assertTrue(fluent.developer)
        self.assertEqual(25, fluent.age)

        self.assertEqual({
            'name': 'john',
            'developer': True,
            'age': 25
        }, fluent.get_attributes())
Exemple #8
0
    def test_set_attributes(self):
        fluent = Fluent()

        fluent.name = "john"
        fluent.developer()
        fluent.age(25)

        self.assertEqual("john", fluent.name)
        self.assertTrue(fluent.developer)
        self.assertEqual(25, fluent.age)

        self.assertEqual({
            "name": "john",
            "developer": True,
            "age": 25
        }, fluent.get_attributes())