Exemplo n.º 1
0
def create_members():
    member1 = models.member("Mohammed", 20)
    member2 = models.member("Mohammed", 22)
    member3 = models.member("Abdo", 25)
    print(member1)
    print(member2)
    print(member3)
    print("=" * 30)

    return member1, member2, member3
Exemplo n.º 2
0
def update_should_modify_object(member_store, member3):
    member3_copy = models.member(member3.name, member3.age)
    member3_copy.id = 3

    if member3_copy is not member3:
        print("member3 and member3_copy are not the same !")

    print(member3_copy)
    member3_copy.name = "John"
    member_store.update(member3_copy)
    print(member_store.get_by_id(member3.id))
Exemplo n.º 3
0
def test_update(member_store, member3):
    member3_copy = models.member(member3.name, member3.age)
    member3_copy.id = 3

    if member3_copy is not member3:
        print("member3 and member3_copy are not the same !")

    print(member3_copy)
    member3_copy.name = "Ahmed"
    member3_copy.age = "26"
    member_store.update(member3_copy)
    print(member_store.get_by_id(member3.id))
Exemplo n.º 4
0
from models import post, member
m1 = member("Brad Pitt", 31)
m2 = member("Mohammed Henidy", 35)
m3 = member("Rami Ayash", 27)

p1 = post("Python", "this is a programming language")
p2 = post("the legend of Tarazan",
          "it's a story about a man who lived with gorillas !")
#testing
print p1
print m1