Exemplo n.º 1
0
 def test_wipedata_command(self):
     """ test clear_data function """
     add_to_db(Path(__file__).absolute().ancestor(1)\
               .child("testdata").child("testdata.csv"))
     clear_data()
     self.assertEqual(Subject.objects.all().count(), 0)
     self.assertEqual(Unit.objects.all().count(), 0)
     self.assertEqual(Variable.objects.all().count(), 0)
     self.assertEqual(Equation.objects.all().count(), 0)
Exemplo n.º 2
0
 def test_addcsv_command(self):
     """ test add_to_db function with small dataset """
     add_to_db(Path(__file__).absolute().ancestor(1)\
               .child("testdata").child("testdata.csv"))
     try:
         s1 = Subject.objects.get(title="Mechanics (Physics 1)")
         u1 = Unit.objects.get(full_name="second")
         v1 = Variable.objects.get(full_name="Mass")
         e1 = Equation.objects.get(quick_name="F=ma")
     except (ObjectDoesNotExist, MultipleObjectsReturned), e:
         raise AssertionError