diff options
Diffstat (limited to 'archaeological_finds/tests.py')
| -rw-r--r-- | archaeological_finds/tests.py | 90 | 
1 files changed, 45 insertions, 45 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 93548f8fc..2ef551253 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -132,10 +132,10 @@ class SerializationTest(GenericSerializationTest, FindInit, TestCase):          ope1 = self.create_operation()[0]          ope2 = self.create_operation()[1]          cr = self.create_context_record( -            data={"label": u"CR 1", "operation": ope1} +            data={"label": "CR 1", "operation": ope1}          )[0]          cr2 = self.create_context_record( -            data={"label": u"CR 2", "operation": ope2} +            data={"label": "CR 2", "operation": ope2}          )[1]          self.create_finds(data_base={"context_record": cr})[0]          self.create_finds(data_base={"context_record": cr2})[1] @@ -555,14 +555,14 @@ class TreatmentWizardCreationTest(WizardTest, FindInit, TestCase):                                 loan.pk)          planned, __ = models.TreatmentState.objects.get_or_create( -            txt_idx='planned', defaults={"executed": False, "label": u"Planned"} +            txt_idx='planned', defaults={"executed": False, "label": "Planned"}          )          planned.executed = False          planned.save()          self.form_datas[0].set('basetreatment', 'treatment_state', planned.pk)          completed, created = models.TreatmentState.objects.get_or_create( -            txt_idx='completed', defaults={"executed": True, "label": u"Done"} +            txt_idx='completed', defaults={"executed": True, "label": "Done"}          )          completed.executed = True          completed.save() @@ -645,7 +645,7 @@ class ImportFindTest(ImportTest, FindInit, TestCase):                                                             mcc_images.read())}          post_dict = {'importer_type': MCC.pk, 'skip_lines': 1,                       "encoding": 'utf-8', "name": 'init_find_import', -                     "csv_sep": u","} +                     "csv_sep": ","}          form = forms_common.NewImportForm(data=post_dict, files=file_dict,                                            user=self.user)          form.is_valid() @@ -855,12 +855,12 @@ class FindTest(FindInit, TestCase):          base_find = find.base_finds.all()[0]          self.assertEqual(              find.external_id, -            u"{}-{}".format( +            "{}-{}".format(                  find.get_first_base_find().context_record.external_id,                  find.label))          self.assertEqual(              base_find.external_id, -            u"{}-{}".format( +            "{}-{}".format(                  base_find.context_record.external_id,                  base_find.label))          base_find.label = "New label" @@ -868,7 +868,7 @@ class FindTest(FindInit, TestCase):          base_find = models.BaseFind.objects.get(pk=base_find.pk)          self.assertEqual(              base_find.external_id, -            u"{}-{}".format( +            "{}-{}".format(                  base_find.context_record.external_id,                  "New label"))          cr = ContextRecord.objects.get(pk=base_find.context_record.pk) @@ -894,28 +894,28 @@ class FindTest(FindInit, TestCase):          find.save()          find = models.Find.objects.get(pk=find.pk)          # default: {get_first_base_find__context_record__external_id}-{label} -        self.assertEqual(find.external_id, u"PAT-12345-A1-new-label-too-hop") +        self.assertEqual(find.external_id, "PAT-12345-A1-new-label-too-hop")          profile = get_current_profile(force=True)          profile.find_external_id = \ -            u"{get_first_base_find__context_record__external_id}-{label}-"\ -            u"{label}" +            "{get_first_base_find__context_record__external_id}-{label}-"\ +            "{label}"          profile.save()          find.save()          find = models.Find.objects.get(pk=find.pk)          self.assertEqual(find.external_id, -                         u"PAT-12345-A1-new-label-too-hop-hop") +                         "PAT-12345-A1-new-label-too-hop-hop")          profile.find_external_id = \ -            u"{get_first_base_find__context_record__external_id}-{label}-" \ -            u"{label}||lower||deduplicate" +            "{get_first_base_find__context_record__external_id}-{label}-" \ +            "{label}||lower||deduplicate"          profile.save()          find.save()          find = models.Find.objects.get(pk=find.pk)          self.assertEqual(find.external_id, -                         u"pat-12345-a1-new-label-too-hop") +                         "pat-12345-a1-new-label-too-hop")      def testIndex(self):          profile = get_current_profile() -        profile.find_index = u"O" +        profile.find_index = "O"          profile.save()          get_current_profile(force=True) @@ -947,7 +947,7 @@ class FindTest(FindInit, TestCase):          self.assertEqual(bf_3.index, 1)          profile = get_current_profile(force=True) -        profile.find_index = u"CR" +        profile.find_index = "CR"          profile.save()          profile = get_current_profile(force=True) @@ -1258,8 +1258,8 @@ class FindSearchTest(FindInit, TestCase, SearchText):          find2.save()          result = [ -            (u'{}="{}"'.format(loan_key, str(_(u"Yes"))), 0), -            (u'{}="{}"'.format(loan_key, str(_(u"No"))), 2), +            ('{}="{}"'.format(loan_key, str(_("Yes"))), 0), +            ('{}="{}"'.format(loan_key, str(_("No"))), 2),          ]          self._test_search(c, result, context="All container in their "                                               "reference location") @@ -1267,8 +1267,8 @@ class FindSearchTest(FindInit, TestCase, SearchText):          find2.save()          result = [ -            (u'{}="{}"'.format(loan_key, str(_(u"Yes"))), 1), -            (u'{}="{}"'.format(loan_key, str(_(u"No"))), 1), +            ('{}="{}"'.format(loan_key, str(_("Yes"))), 1), +            ('{}="{}"'.format(loan_key, str(_("No"))), 1),          ]          self._test_search(c, result, context="One container in his "                                               "reference location") @@ -1347,10 +1347,10 @@ class FindPermissionTest(FindInit, TestCase):          self.create_context_record(              user=self.user, -            data={"label": u"CR 1", "operation": self.operations[0]}) +            data={"label": "CR 1", "operation": self.operations[0]})          self.create_context_record(              user=self.alt_user, -            data={"label": u"CR 2", "operation": self.operations[1]}) +            data={"label": "CR 2", "operation": self.operations[1]})          self.cr_1 = self.context_records[-2]          self.cr_2 = self.context_records[-1] @@ -1394,8 +1394,8 @@ class FindQATest(FindInit, TestCase):      model = models.Find      def setUp(self): -        self.create_finds(data_base={"label": u"Find 1"}, force=True) -        self.create_finds(data_base={"label": u"Find 2"}, force=True) +        self.create_finds(data_base={"label": "Find 1"}, force=True) +        self.create_finds(data_base={"label": "Find 2"}, force=True)          self.username, self.password, self.user = create_superuser()          self.alt_username, self.alt_password, self.alt_user = create_user()          self.alt_user.user_permissions.add(Permission.objects.get( @@ -1457,7 +1457,7 @@ class FindQATest(FindInit, TestCase):      def test_bulk_update(self):          c = Client() -        pks = u"{}-{}".format(self.finds[0].pk, self.finds[1].pk) +        pks = "{}-{}".format(self.finds[0].pk, self.finds[1].pk)          response = c.get(reverse('find-qa-bulk-update', args=[pks]))          self.assertRedirects(response, '/') @@ -1473,10 +1473,10 @@ class FindQATest(FindInit, TestCase):          find_0 = self.finds[0]          find_1 = self.finds[1] -        base_desc_0 = u"Base description 1" +        base_desc_0 = "Base description 1"          find_0.description = base_desc_0          find_0.save() -        base_desc_1 = u"Base description 2" +        base_desc_1 = "Base description 2"          find_1.description = base_desc_1          find_1.save() @@ -1485,7 +1485,7 @@ class FindQATest(FindInit, TestCase):                           [dating.period.pk for dating in find_0.datings.all()])          self.assertNotIn(period,                           [dating.period.pk for dating in find_1.datings.all()]) -        extra_desc = u"Extra description" +        extra_desc = "Extra description"          response = c.post(              reverse('find-qa-bulk-update-confirm', args=[pks]),              {'qa_period': period, 'qa_description': extra_desc} @@ -1497,9 +1497,9 @@ class FindQATest(FindInit, TestCase):          self.assertIn(period,                        [dating.period.pk for dating in find_1.datings.all()])          self.assertEqual(models.Find.objects.get(pk=find_0.pk).description, -                         base_desc_0 + u"\n" + extra_desc) +                         base_desc_0 + "\n" + extra_desc)          self.assertEqual(models.Find.objects.get(pk=find_1.pk).description, -                         base_desc_1 + u"\n" + extra_desc) +                         base_desc_1 + "\n" + extra_desc)      def test_basket(self):          find_0 = self.finds[0] @@ -1562,7 +1562,7 @@ class FindQATest(FindInit, TestCase):          c = Client()          find_0 = self.finds[0]          find_1 = self.finds[1] -        pks = u"{}-{}".format(find_0.pk, find_1.pk) +        pks = "{}-{}".format(find_0.pk, find_1.pk)          url = reverse('find-qa-packaging', args=[pks])          response = c.get(url)          self.assertRedirects(response, '/') @@ -1674,7 +1674,7 @@ class FindHistoryTest(FindInit, TestCase):      model = models.Find      def setUp(self): -        self.create_finds(data_base={"label": u"Find 1"}, force=True) +        self.create_finds(data_base={"label": "Find 1"}, force=True)          self.username, self.password, self.user = create_superuser()          self.client = Client()          self.client.login(username=self.username, password=self.password) @@ -1687,7 +1687,7 @@ class FindHistoryTest(FindInit, TestCase):              'dating_type': DatingType.objects.get(                  txt_idx='from_absolute_dating'),              "quality": DatingQuality.objects.get(txt_idx='sure'), -            "precise_dating": u"Blah !!!" +            "precise_dating": "Blah !!!"          }          d1 = Dating.objects.create(**d1_attrs)          d2_attrs = { @@ -1816,9 +1816,9 @@ class FindHistoryTest(FindInit, TestCase):          self.assertIn('class="card sheet"', content)          self.assertIn(              models.MaterialType.objects.get(txt_idx='ceramic').label, content, -            msg=u"ceramic not found in historical sheet") -        self.assertIn("5001", content, msg=u"5001 not found in historical " -                                           u"sheet") +            msg="ceramic not found in historical sheet") +        self.assertIn("5001", content, msg="5001 not found in historical " +                                           "sheet")          self.assertIn(              Period.objects.get(txt_idx='neolithic').label, content) @@ -1874,8 +1874,8 @@ class TreatmentTest(FindInit, TestCase):          img = os.path.join(temp_dir, 'ishtar-bg.jpg')          shutil.copy2(base_img, img) -        self.create_finds(data_base={"label": u"Find 1"}, force=True) -        self.create_finds(data_base={"label": u"Find 2"}, force=True) +        self.create_finds(data_base={"label": "Find 1"}, force=True) +        self.create_finds(data_base={"label": "Find 2"}, force=True)          image = Document.objects.create(title="Image!")          image.image.save('ishtar-bg.jpg', File(open(img, "rb")))          self.finds[0].documents.add(image) @@ -1903,7 +1903,7 @@ class TreatmentTest(FindInit, TestCase):          first_find = self.finds[0]          completed, created = models.TreatmentState.objects.get_or_create( -            txt_idx='completed', defaults={"executed": True, "label": u"Done"} +            txt_idx='completed', defaults={"executed": True, "label": "Done"}          )          completed.executed = True          completed.save() @@ -1951,7 +1951,7 @@ class TreatmentTest(FindInit, TestCase):          initial_find = self.finds[0]          completed, created = models.TreatmentState.objects.get_or_create( -            txt_idx='completed', defaults={"executed": True, "label": u"Done"} +            txt_idx='completed', defaults={"executed": True, "label": "Done"}          )          completed.executed = True          completed.save() @@ -1987,7 +1987,7 @@ class TreatmentTest(FindInit, TestCase):          initial_find = self.finds[0]          completed, created = models.TreatmentState.objects.get_or_create( -            txt_idx='completed', defaults={"executed": True, "label": u"Done"} +            txt_idx='completed', defaults={"executed": True, "label": "Done"}          )          completed.executed = True          completed.save() @@ -2028,7 +2028,7 @@ class TreatmentTest(FindInit, TestCase):          initial_find = self.finds[0]          completed, created = models.TreatmentState.objects.get_or_create( -            txt_idx='completed', defaults={"executed": True, "label": u"Done"} +            txt_idx='completed', defaults={"executed": True, "label": "Done"}          )          completed.executed = True          completed.save() @@ -2062,7 +2062,7 @@ class GeomaticTest(FindInit, TestCase):      model = models.Find      def setUp(self): -        self.create_finds(data_base={"label": u"Find 1"}, force=True) +        self.create_finds(data_base={"label": "Find 1"}, force=True)      def test_point_precision(self):          self.username = 'myuser' @@ -2429,7 +2429,7 @@ class PublicAPITest(FindInit, APITestCase):      model = models.Find      def setUp(self): -        self.create_finds(data_base={"label": u"Find 1"}, force=True) +        self.create_finds(data_base={"label": "Find 1"}, force=True)          self.basket = models.FindBasket.objects.create(              slug="my-basket", label="My basket",              user=IshtarUser.objects.get(pk=self.get_default_user().pk))  | 
