23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct
Dataset Card for LLMcoder-GitHub-Python-Mix-Direct Python target autocomplete suggestions in the format of conversations for OpenAI's fine-tuning. Dataset Details Dataset Description Curated by: [More Information Needed] Funded by [optional]: [More Information Needed] Shared by [optional]: [More Information Needed] Language(s) (NLP): [More Information Needed] License: [More Information Needed] Dataset Sources [optional] The data… See the full description on the dataset page: https://huggingface.co/datasets/23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct.
0216
1s.2 """3 changes = self.get_changes([self.author_name_null], [self.author_name_default])4 # Right number/type of migrations?5 self.assertNumberMigrations(changes, "testapp", 1)6 self.assertOperationTypes(changes, "testapp", 0, ["AlterField"])7 self.assertOperationAttributes(8 changes, "testapp", 0, 0, name="name", preserve_default=True9 )10 self.assertOperationFieldAttributes(11 changes, "testapp", 0, 0, default="Ada Lovelace"12 )13 14 @mock.patch(15 "django.db.migrations.questioner.MigrationQuestioner.ask_not_null_alteration",16 side_effect=AssertionError("Should not have prompted for not null alteration"),17 )18 def test_alter_field_to_not_null_with_db_default(self, mocked_ask_method):19 changes = self.get_changes(20 [self.author_name_null], [self.author_name_db_default]21 )22 self.assertNumberMigrations(changes, "testapp", 1)23 self.assertOperationTypes(changes, "testapp", 0, ["AlterField"])24 self.assertOperationAttributes(25 changes, "testapp", 0, 0, name="name", preserve_default=True26 )27 self.assertOperationFieldAttributes(28 changes, "testapp", 0, 0, db_default=models.Value("Ada Lovelace")29 )30 31 @mock.patch(32 "django.db.migrations.questioner.MigrationQuestioner.ask_not_null_alteration",33 return_value=models.NOT_PROVIDED,34 )35 def test_alter_field_to_not_null_without_default(self, mocked_ask_method):36 """37 #23609 - Tests autodetection of nullable to non-nullable alterations.38 """39 changes = self.get_changes([self.author_name_null], [self.author_name])40 self.assertEqual(mocked_ask_method.call_count, 1)41 # Right number/type of migrations?42 self.assertNumberMigrations(changes, "testapp", 1)43 self.assertOperationTypes(changes, "testapp", 0, ["AlterField"])44 self.assertOperationAttributes(45 changes, "testapp", 0, 0, name="name", preserve_default=True46 )47 self.assertOperationFieldAttributes(48 changes, "testapp", 0, 0, default=models.NOT_PROVIDED49 )50 51 @mock.patch(52 "django.db.migrations.questioner.MigrationQuestioner.ask_not_null_alteration",53 return_value="Some Name",54 )55 def test_alter_field_to_not_null_oneoff_default(self, mocked_ask_method):56 """57 #23609 - Tests autodetection of nullable to non-nullable alterations.58 """59 changes = self.get_changes([self.author_name_null], [self.author_name])60 self.assertEqual(mocked_ask_method.call_count, 1)61 # Right number/type of migrations?62 self.assertNumberMigrations(changes, "testapp", 1)63 self.assertOperationTypes(changes, "testapp", 0, ["AlterField"])64 self.assertOperationAttributes(65 changes, "testapp", 0, 0, name="name", preserve_default=False66 )67 self.assertOperationFieldAttributes(68 changes, "testapp", 0, 0, default="Some Name"69 )70 71 def test_rename_field(self):72 """Tests autodetection of renamed fields."""73 changes = self.get_changes(74 [self.author_name],75 [self.author_name_renamed],76 MigrationQuestioner({"ask_rename": True}),77 )78 # Right number/type of migrations?79 self.assertNumberMigrations(changes, "testapp", 1)80 self.assertOperationTypes(changes, "testapp", 0, ["RenameField"])81 self.assertOperationAttributes(82 changes, "testapp", 0, 0, old_name="name", new_name="names"83 )84 85 def test_rename_field_foreign_key_to_field(self):86 before = [87 ModelState(88 "app",89 "Foo",90 [91 ("id", models.AutoField(primary_key=True)),92 ("field", models.IntegerField(unique=True)),93 ],94 ),95 ModelState(96 "app",97 "Bar",98 [99 ("id", models.AutoField(primary_key=True)),100 (101 "foo",102 models.ForeignKey("app.Foo", models.CASCADE, to_field="field"),103 ),104 ],105 ),106 ]107 after = [108 ModelState(109 "app",110 "Foo",111 [112 ("id", models.AutoField(primary_key=True)),113 ("renamed_field", models.IntegerField(unique=True)),114 ],115 ),116 ModelState(117 "app",118 "Bar",119 [120 ("id", models.AutoField(primary_key=True)),121 (122 "foo",123 models.ForeignKey(124 "app.Foo", models.CASCADE, to_field="renamed_field"125 ),126 ),127 ],128 ),129 ]130 changes = self.get_changes(131 before, after, MigrationQuestioner({"ask_rename": True})132 )133 # Right number/type of migrations?134 self.assertNumberMigrations(changes, "app", 1)135 self.assertOperationTypes(changes, "app", 0, ["RenameField"])136 self.assertOperationAttributes(137 changes, "app", 0, 0, old_name="field", new_name="renamed_field"138 )139 140 def test_foreign_object_from_to_fields_list(self):141 author_state = ModelState(142 "app",143 "Author",144 [("id", models.AutoField(primary_key=True))],145 )146 book_state = ModelState(147 "app",148 "Book",149 [150 ("id", models.AutoField(primary_key=True)),151 ("name", models.CharField()),152 ("author_id", models.IntegerField()),153 (154 "author",155 models.ForeignObject(156 "app.Author",157 models.CASCADE,158 from_fields=["author_id"],159 to_fields=["id"],160 ),161 ),162 ],163 