当前位置: 首页>>代码示例>>Python>>正文


Python Wares.insert方法代码示例

本文整理汇总了Python中polls.models.Wares.insert方法的典型用法代码示例。如果您正苦于以下问题:Python Wares.insert方法的具体用法?Python Wares.insert怎么用?Python Wares.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在polls.models.Wares的用法示例。


在下文中一共展示了Wares.insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_insertware

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_insertware(self):
     #Tests that a ware can be inserted with insert function
     Wares.insert("Carlsberg")
     self.assertEqual(len(Wares.objects.all().filter(warename="Carlsberg")) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(warename="Calrsberg")) == 1, False)
     Wares.insert("Tuborg")
     self.assertEqual(len(Wares.objects.all().filter(warename="Tuborg")) == 1, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:9,代码来源:tests.py

示例2: test_setinbar

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_setinbar(self): 
     Wares.insert("Carslberg")
     Wares.insert("Tuborg")
     Wares.setwareinbar(1,5)
     Wares.setwareinbar(2,10)
     self.assertEqual(len(Wares.objects.all().filter(inbar=5)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(inbar=10)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(inbar=2)) == 2, False)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:10,代码来源:tests.py

示例3: test_insertgrouping

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_insertgrouping(self):
     Wares.insert("Carlsberg")
     Wares.insert("Tuborg")
     Waregroups.insert("Luxusoeller")
     Waregroups.insert("Basisoeller")
     Waresingroup.insert(1,1)
     Waresingroup.insert(1,2)
     Waresingroup.insert(2,1)
     Waresingroup.insert(2,2)
     self.assertEqual(len(Wares.objects.all()) == 2, True)
     self.assertEqual(len(Waregroups.objects.all()) == 2, True)
     self.assertEqual(len(Waresingroup.objects.all()) == 2, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:14,代码来源:tests.py

示例4: test_deleteonrelations1

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_deleteonrelations1(self):
     Wares.insert("Carlsberg")
     Wares.insert("Tuborg")
     Waregroups.insert("Luxusoeller")
     Waregroups.insert("Basisoeller")
     Waresingroup.insert(1,1)
     Waresingroup.insert(1,2)
     Waresingroup.insert(2,1)
     Waresingroup.insert(2,2)
     self.assertEqual(len(Waresingroup.objects.all()) == 2, True)
     Waregroups.deletethis(2)
     self.assertEqual(len(Waresingroup.objects.all()) == 0, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:14,代码来源:tests.py

示例5: test_getstdprice

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_getstdprice(self): 
     Wares.insert("Carslberg")
     Wares.insert("Tuborg")
     Wares.setwareinbar(1,5)
     Wares.setwareinbar(2,10)
     self.assertEqual(len(Wares.objects.all().filter(inbar=5)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(inbar=10)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(inbar=2)) == 2, False)
     Wares.setstandardprice(1,10)
     Wares.setstandardprice(2,30)
     self.assertEqual(Wares.getstdprice(1) == 10, True)
     self.assertEqual(Wares.getstdprice(1) == 30, False)
     self.assertEqual(Wares.getstdprice(2) == 30, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:15,代码来源:tests.py

示例6: test_removeware

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_removeware(self):
     Wares.insert("Carslberg")
     Wares.insert("Tuborg")
     Wares.insert("Heineken")
     self.assertEqual(len(Wares.objects.all()) == 3, True)
     Wares.deletethis(1)
     self.assertEqual(len(Wares.objects.all()) == 2, True)
     Wares.insert("Carslberg")
     Wares.deletethis(4) 
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:11,代码来源:tests.py

示例7: test_insertpricing

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_insertpricing(self):
     Wares.insert("Carlsberg")
     Wares.insert("Tuborg")
     Wares.setstandardprice(1,500) #Carlsberg er dyrt
     Wares.setstandardprice(2,50)
     Events.insert("Paaske")
     Events.insert("frebar")
     Events.insert("hverdag")
     
     Pricesinevent.insert(1,1)
     Pricesinevent.insert(1,2)
     Pricesinevent.insert(1,3)
     Pricesinevent.insert(2,1)
     Pricesinevent.insert(2,2)
     Pricesinevent.insert(2,3)
     self.assertEqual(len(Events.objects.all()) == 3, True)
     self.assertEqual(len(Pricesinevent.objects.all()) == 6, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:19,代码来源:tests.py

示例8: test_geteventprice

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
    def test_geteventprice(self):
        Wares.insert("Carlsberg")
        Wares.insert("Tuborg")
        Wares.setstandardprice(1,500) #Carlsberg er dyrt
        Wares.setstandardprice(2,50)
        Events.insert("Paaske")
        Events.insert("frebar")
        Events.insert("hverdag")
        
        Pricesinevent.insert(1,1)
        Pricesinevent.insert(1,2)
        Pricesinevent.insert(1,3)
        Pricesinevent.insert(2,1)
        Pricesinevent.insert(2,2)
        Pricesinevent.insert(2,3)
        
        newprice = Pricesinevent.geteventprice(1,1)
        self.assertEqual(newprice==500, True)

        Pricesinevent.setprice(1,1,-50)
        
        newprice = Pricesinevent.geteventprice(1,1)
        self.assertEqual(newprice==500, False)
        self.assertEqual(newprice==450, True)
        
        Pricesinevent.setprice(1,1,-50)
        newprice = Pricesinevent.geteventprice(1,1)
        self.assertEqual(newprice==450, True)

        Pricesinevent.setprice(2,1,-50)
        newprice = Pricesinevent.geteventprice(2,1)
        self.assertEqual(newprice==0, True)

        Pricesinevent.setprice(2,1,-100)
        newprice = Pricesinevent.geteventprice(2,1)
        self.assertEqual(newprice==-50, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:38,代码来源:tests.py

示例9: test_setinstockroom

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_setinstockroom(self): 
     Wares.insert("Carslberg")
     Wares.insert("Tuborg")
     Wares.insert("Heineken")
     Wares.setwareinstockroom(1,5)
     Wares.setwareinstockroom(2,10)
     Wares.setwareinbar(3,20)
     self.assertEqual(len(Wares.objects.all().filter(instockroom=5)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(instockroom=10)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(instockroom=20)) == 1, False)
     self.assertEqual(len(Wares.objects.all().filter(instockroom=2)) == 2, False)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:13,代码来源:tests.py

示例10: test_getwaresforopening

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_getwaresforopening(self):
     Wares.insert("Carslberg")
     Wares.insert("Tuborg")
     Wares.insert("Heineken")
     self.assertEqual(len(Wares.objects.all()) == 3, True)
     self.assertEqual(len(Wares.getopeningwares()) == 0, True)
     Wares.setwareinbar(1,1)
     self.assertEqual(len(Wares.getopeningwares()) == 1, True)
     Wares.setwareinstockroom(1,2)
     self.assertEqual(len(Wares.getopeningwares()) == 1, True)
     Wares.setwareinstockroom(2,2)
     self.assertEqual(len(Wares.getopeningwares()) == 2, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:14,代码来源:tests.py

示例11: test_standardprice

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_standardprice(self):
     Wares.insert("Carslberg")
     Wares.insert("Tuborg")
     Wares.insert("Heineken")
     Wares.setwareinbar(1,5)
     Wares.setwareinstockroom(1,5)
     Wares.setstandardprice(1,500) #Carlsberg er dyrt
     Wares.setstandardprice(2,50)
     Wares.setstandardprice(3,50) 
     self.assertEqual(len(Wares.objects.all().filter(standardprice=500)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(standardprice=50)) == 2, True)
     self.assertEqual(len(Wares.objects.all()) == 3, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:14,代码来源:tests.py

示例12: test_getwaregroups

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_getwaregroups(self):
     Wares.insert("Carlsberg")
     Wares.insert("Tuborg")
     Wares.insert("Heineken")
     Waregroups.insert("Luxusoeller")
     Waregroups.insert("Basisoeller")
     Waresingroup.insert(1,1)
     Waresingroup.insert(1,2)
     Waresingroup.insert(2,1)
     Waresingroup.insert(2,2)
     Waresingroup.insert(3,1)
     self.assertEqual(len(Waresingroup.getwaregroups(1)) == 1, True)
     self.assertEqual(len(Waresingroup.getwaregroups(2)) == 1, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:15,代码来源:tests.py

示例13: test_getthis

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_getthis(self):
     Wares.insert("Carlsberg")
     Wares.insert("Tuborg")
     Wares.insert("Heineken")
     Waregroups.insert("Luxusoeller")
     Waregroups.insert("Basisoeller")
     Waresingroup.insert(1,1)
     Waresingroup.insert(1,2)
     Waresingroup.insert(2,1)
     Waresingroup.insert(2,2)
     Waresingroup.insert(3,1)
     test1 = Waresingroup.getthis(1,2)
     self.assertEqual(test1.ware.warename == "Carlsberg", True)
     self.assertEqual(test1.waregroup.wgname == "Basisoeller", True)
     test2 = Waresingroup.getthis(3,1)
     self.assertEqual(test2.ware.warename == "Heineken", True)
     self.assertEqual(test2.waregroup.wgname == "Luxusoeller", True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:19,代码来源:tests.py

示例14: createware

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
def createware(request):
    error = [] 
    if ('valgnavn' in request.POST): 
        newname = request.POST['valgnavn']
        if newname == "":
            error.append("Du skal vælge et navn")
        elif 'ja' in request.POST:
            Wares.insert(newname)
            ware = Wares.get_last()
            form = WareForm()
            Wares.insert(newname + " (åbnet vare)")
            #Sends user to details for ware
            return render(request, 'polls/detail.html', {'form': form,'ware':ware})

        else:
            Wares.insert(newname)
            ware = Wares.get_last()
            form = WareForm()
            #Sends user to details for ware
            return render(request, 'polls/detail.html', {'form': form, 'ware':ware})
    return render(request, 'polls/skab_vare.html', {'error': error})    
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:23,代码来源:views.py

示例15: test_getprice

# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import insert [as 别名]
 def test_getprice(self):
     Wares.insert("Carslberg")
     Wares.insert("Tuborg")
     Wares.insert("Heineken")
     Wares.setwareinbar(1,5)
     Wares.setwareinstockroom(1,5)
     Wares.setstandardprice(1,500) #Carlsberg er dyrt
     Wares.setstandardprice(2,50)
     Wares.setstandardprice(3,50) 
     self.assertEqual(len(Wares.objects.all().filter(standardprice=500)) == 1, True)
     self.assertEqual(len(Wares.objects.all().filter(standardprice=50)) == 2, True)
     self.assertEqual(len(Wares.objects.all()) == 3, True)
     Events.insert("Paaske")
     Events.insert("frebar")
     Events.insert("hverdag")
     Pricesinevent.insert(1,1)
     Pricesinevent.insert(1,2)
     Pricesinevent.insert(1,3)
     Pricesinevent.insert(2,1)
     Pricesinevent.insert(2,2)
     Pricesinevent.insert(2,3)
     Pricesinevent.setprice(1,1,-50)
     self.assertEqual(Extrafunctions.getprice(1,1) == 450, True)
开发者ID:cejsing,项目名称:Softwareudvikling,代码行数:25,代码来源:tests.py


注:本文中的polls.models.Wares.insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。