problem_id
int64
1
113
programming_language
stringclasses
2 values
original_code
stringlengths
0
29.4k
highlighted_code
stringlengths
0
6.05k
instruction
stringlengths
5
5.17k
test_code
stringlengths
553
29.5k
requirements
stringlengths
18
122
conftest
stringclasses
3 values
test_utils
stringclasses
7 values
split
stringclasses
1 value
package_json
stringclasses
9 values
jest_setup
stringclasses
9 values
babel_config
stringclasses
5 values
other_files
dict
jest_dom_setup
stringclasses
1 value
101
python
import json import random from groq import Groq import os from dotenv import load_dotenv load_dotenv() api_key = os.getenv("GROQ_API_KEY") client = Groq(api_key=api_key) class SCP_Object: def __init__(self, name, description, triggers, initial_state): self.name = name self.description = descripti...
def emulate_experiment(self, instruction): self.experiment_log.append(f"Instruction: {instruction}") # Initial checks clarity_check = self.check_instruction_clarity(instruction) if clarity_check["decision"] == "False": self.experiment_log.append(f"Instruction not...
continue this function with SCP object prompting, just like D_personal
import ast import inspect import pytest def extract_generate_possible_actions_branches(module_code, d_class_name, scp_class_name): """Extract the AST bodies of the D_Personnel and SCP_Object branches in generate_possible_actions.""" try: parsed = ast.parse(module_code) except SyntaxError as e: ...
pytest pytest-mock groq python-dotenv
import pytest import os import sys import json from typing import Dict, List, Optional, Any # Import from local test_utils.py in the same directory from test_utils import TestUtils, TestResultsManager # Load all implementations in the current sandbox implementations = TestUtils.load_all_implementations() test_results...
import os import sys import glob import re import importlib.util import traceback import types from typing import Dict, List, Optional, Any, Tuple class TestUtils: @staticmethod def discover_implementation_files(directory: str = None) -> List[str]: """Find all implementation files in the current sandbo...
test
null
null
null
null
null
102
python
import pandas as pd import os import random import torch import numpy as np from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics import precision_score, recall_score from torch.nn import functional as F from PIL import Image, ImageDraw, ImageFont import matplotlib.pyplot as plt import seaborn as ...
# Ensure similarity_map is float32 and on the CPU before using numpy operations similarity_map_cpu = similarity_map.to(dtype=torch.float32).cpu().numpy()
add a check to avoid this operation if it is already a numpy format
import ast import inspect import pytest def test_similarity_map_cpu_guarded(implementation): """ Ensure that within `evaluate_image_maps`, the line with `similarity_map.to(dtype=torch.float32).cpu().numpy()` is preceded by an `if` statement that includes 'np' or 'numpy'. """ impl_name, module =...
numpy torch pytest pytest-mock pillow matplotlib seaborn pandas scikit-learn colpali-engine
import pytest import os import sys import json from typing import Dict, List, Optional, Any # Import from local test_utils.py in the same directory from test_utils import TestUtils, TestResultsManager # Load all implementations in the current sandbox implementations = TestUtils.load_all_implementations() test_results...
import os import sys import glob import re import importlib.util import traceback import types from typing import Dict, List, Optional, Any, Tuple class TestUtils: @staticmethod def discover_implementation_files(directory: str = None) -> List[str]: """Find all implementation files in the current sandbo...
test
null
null
null
null
null
103
python
from ast import Add from asyncio import wait from curses import COLOR_BLUE, COLOR_RED from re import A from shutil import move from glm import degrees from manim import * from numpy import size, square class Project(Scene): def construct(self): text = Tex("Double Angle") self.play( Write(text)) ...
step2_exp8 = MathTex(r"\cos x (0) + \sin x (1) = \sin x", color=WHITE) step2_exp8.move_to(ORIGIN) self.play( FadeOut(step2_exp6, step2_exp7), Write(step2_exp8) ) self.wait(2) self.play(FadeOut(step2_exp8, step2))
Move the proved sinx to center of the screen and fade out rest of equation
import pytest import re import inspect from typing import List import ast def get_source_code(impl_name, module) -> str: """Get the source code of the implementation module""" try: return inspect.getsource(module) except Exception: return "" import re from typing import List def test_move...
pytest pytest-mock manim numpy pyglm pydub
import pytest import os import sys import json from typing import Dict, List, Optional, Any # Import from local test_utils.py in the same directory from test_utils import TestUtils, TestResultsManager # Load all implementations in the current sandbox implementations = TestUtils.load_all_implementations() test_results...
import os import sys import glob import re import importlib.util import traceback import types from typing import Dict, List, Optional, Any, Tuple class TestUtils: @staticmethod def discover_implementation_files(directory: str = None) -> List[str]: """Find all implementation files in the current sandbo...
test
null
null
null
null
null
104
python
import requests #для запроса к API import xml.etree.ElementTree #для обработки xml-ответа API import datetime #для дат по оси иксов import pickle #для хранения переменных в файле import json #фак ю нигер #допиши чтобы set_valutes заполнялось!!! оно факинг нигер и не заполняется #класс валюта class valute(): """В...
def correct_name(self): """Проверка имени валюты на наличие в множестве валют. Множество обновляется не чаще раза в день""" info_opened_file = open(r"D:\MoexAPI_bot_aiogram3\data_files\Info.json", "r", encoding="utf-8") #открываем файл инфы, encoding чтобы не было info = json.load(info_opene...
перепиши метод асинхронно, импортировав aiofiles и сохранив мои комментарии
import asyncio import inspect import json import pickle from datetime import datetime, timedelta from unittest.mock import AsyncMock, MagicMock, patch import pytest import sys import aiofiles class AsyncContextManagerMock: """A mock for async context managers with awaitable methods like read/write""" def __ini...
aiofiles aiohttp pytest pytest-asyncio pytest-mock requests
import pytest import os import sys import json from typing import Dict, List, Optional, Any # Import from local test_utils.py in the same directory from test_utils import TestUtils, TestResultsManager # Load all implementations in the current sandbox implementations = TestUtils.load_all_implementations() test_results...
import os import sys import glob import re import importlib.util import traceback import types from typing import Dict, List, Optional, Any, Tuple class TestUtils: @staticmethod def discover_implementation_files(directory: str = None) -> List[str]: """Find all implementation files in the current sandbo...
test
null
null
null
null
null
105
javascript
import { messages } from "./messages.js"; $().ready(() => { const loading = $('.container-loading'); const payment = $('.payment-section'); const info = $('.user-info'); const main = $('.main'); // Retrieve values from localStorage const storedData = JSON.parse(localStorage.getItem('userData')) |...
// Retrieve values from localStorage const storedData = JSON.parse(localStorage.getItem('userData')) || {}; const { userInfo, paymentInfo } = storedData; // Use the retrieved data as needed console.log('User Info:', userInfo); console.log('Payment Info:', paymentInfo);
with jquerry
/** * Test suite for jQuery implementations * * This suite evaluates implementations against two key criteria: * 1. Avoiding deprecated $.parseJSON method * 2. Using jQuery methods to manipulate data */ // Import utilities from jest-setup.js const { discoverImplementationFiles, countJQueryUsage, usesDepre...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "scripts": { "test": "jest" }, "devDependencies": { "jest": "^29.7.0", "glob": "^10.3.10", "@babel/core": "^7.21.4", "@babel/preset-env": "...
/** * Jest setup file for jQuery implementations tests */ const fs = require('fs'); const path = require('path'); const glob = require('glob'); // ===================================================================== // Test Utilities // ===================================================================== /** * D...
module.exports = { presets: [ ['@babel/preset-env', {targets: {node: 'current'}}] ] };
{ "hidden.js": "import { messages } from \"./messages.js\";\n\n$(() => {\n const $loading = $('.container-loading');\n const $payment = $('.payment-section');\n const $info = $('.user-info');\n const $main = $('.main');\n const $loadMessages = $('#loading-messages');\n\n // Retrieve and display user...
null
106
javascript
import React, { useEffect, useState, useCallback } from 'react'; import styles from './GameUI.module.css'; import { useLocation } from 'react-router-dom'; import CharacterStatUI from '../character-stat-ui/CharacterStatUI'; import Sprite from '../sprite/Sprite'; import GameMap from '../game-map/GameMap'; import { charac...
const [characters, setCharacters] = useState([ for (let i = 0; i < characterNames.length; i++) { characterNames[i]: characterData(characterName) } ],[characterNames]);
Please fix this error: 'Line 28:4: Parsing error: Unexpected token (28:4)'
const fs = require('fs'); const path = require('path'); const { resultsManager } = require('../jest-setup'); /** * A focused test that executes the character data mapping and validates the structure */ describe('GameUI Character Data Mapping Tests', () => { // Clear existing test results to make sure we only inclu...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "scripts": { "test": "jest" }, "devDependencies": { "@babel/core": "^7.27.1", "@babel/preset-env": "^7.27.2", "@babel/preset-react": "^7.27.1",...
// jest-setup.js - Copy this file to each implementation folder const fs = require('fs'); const path = require('path'); const glob = require('glob'); const { TextEncoder, TextDecoder } = require('util'); global.TextEncoder = TextEncoder; global.TextDecoder = TextDecoder; // Import @testing-library/jest-dom require('@t...
module.exports = { presets: [ '@babel/preset-env', ['@babel/preset-react', { runtime: 'automatic' }], ], };
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": "import React from 'react';\n\nconst MapCharacter = ({ character }) => (\n <div data-testid={`map-character-${character}`}>\n {character}\n </div>\n);\n\nexport default MapCharacter;", "__mocks_...
null
107
javascript
import { useState, useEffect, useCallback, useMemo } from 'react'; function useDashboardData(user) { const [data, setData] = useState({ customerData: { summary: null, loading: false, customers: [] }, healthData: [], websiteStatus: { checking: false }, stripeApiKey: "", dateRange: { startDat...
import { useState, useEffect, useCallback, useMemo } from 'react'; function useDashboardData(user) { const [data, setData] = useState({ customerData: { summary: null, loading: false, customers: [] }, healthData: [], websiteStatus: { checking: false }, stripeApiKey: "", dateRange: { startDat...
optimize it
// Performance tester for useDashboardData implementations const fs = require('fs'); const path = require('path'); const glob = require('glob'); const { performance } = require('perf_hooks'); const vm = require('vm'); const babel = require('@babel/core'); const React = require('react'); // Mock React hooks for perform...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "scripts": { "test": "node tests/performance_tester.js" }, "devDependencies": { "@babel/core": "^7.27.1", "@babel/preset-env": "^7.27.2", "@bab...
// jest-setup.js - Copy this file to each implementation folder const fs = require('fs'); const path = require('path'); const glob = require('glob'); // Import React testing utilities require('@testing-library/jest-dom'); /** * Utility class to handle JavaScript implementations */ class TestUtils { /** * Find ...
module.exports = { presets: [ ['@babel/preset-env', { targets: { node: 'current' } }], ['@babel/preset-react', { runtime: 'automatic' }] ], // Add support for .jsx files plugins: [] };
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": null, "__mocks__/Sprite.jsx": null, "__mocks__/GameMap.jsx": null, "__mocks__/CharacterStatUI.jsx": null, "__mocks__/CharacterData.js": null, "__mocks__/react-router-dom.js": null, "__mocks...
null
108
javascript
const cameraService = require('./camera.service'); const createCamera = async (req, res) => { try { const camera = await cameraService.createCamera(req.body); res.status(201).json(camera); } catch (error) { res.status(500).json({ error: error.message }); } }; const getAllCameras = async (req, res) =...
const createCamera = async (req, res) => { try { const camera = await cameraService.createCamera(req.body); res.status(201).json(camera); } catch (error) { res.status(500).json({ error: error.message }); } };
after createCamera , I want to get all fields on cameras and area_name on areas to res . join 2 table: cameras and areas by cameras.area_id = areas.id . using raw query
/** * Test suite for camera controller implementations * * This file contains the tests for each implementation, * using the utilities and data from jest-setup.js. */ // Import utilities from jest-setup.js const { mockCameraService, createMockRequest, createMockResponse, resultsManager, implementations ...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "scripts": { "test": "jest" }, "devDependencies": { "jest": "^29.7.0", "glob": "^10.3.10" }, "jest": { "setupFilesAfterEnv": ["./jest-setup...
/** * Jest setup file for camera controller testing * * This file contains common utilities, mocks, and test helpers * that are used by the test files. */ const fs = require('fs'); const path = require('path'); const glob = require('glob'); // SECTION 1: Mock data and utilities // -------------------------------...
null
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": null, "__mocks__/Sprite.jsx": null, "__mocks__/GameMap.jsx": null, "__mocks__/CharacterStatUI.jsx": null, "__mocks__/CharacterData.js": null, "__mocks__/react-router-dom.js": null, "__mocks...
null
109
javascript
function createTurnState(allyStates, foeStates) { // Find current turn based wich group still has units that can act let turnNumber = 1; function getCurrentTurn() { return currentTurn; } function getTurnNumber() { return turnNumber; } function nextTurn() { if (currentTurn === "player") {...
Find current turn based wich group still has units that can act
/** * Test suite for evaluating JavaScript implementations * * This test suite tests multiple JavaScript implementations against the instruction: * "Find current turn based which group still has units that can act" */ // Access the utility functions and implementations from jest-setup const { TurnStateTestUtils ...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "scripts": { "test": "jest" }, "devDependencies": { "@babel/core": "^7.22.5", "@babel/preset-env": "^7.22.5", "babel-jest": "^29.7.0", "jes...
// jest-setup.js - Global test setup and utilities const fs = require('fs'); const path = require('path'); const glob = require('glob'); /** * Utility class to handle JavaScript implementations */ class TestUtils { /** * Find all implementation files in the current directory * @param {string} directory - Dir...
module.exports = { presets: [ ['@babel/preset-env', {targets: {node: 'current'}}] ] };
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": null, "__mocks__/Sprite.jsx": null, "__mocks__/GameMap.jsx": null, "__mocks__/CharacterStatUI.jsx": null, "__mocks__/CharacterData.js": null, "__mocks__/react-router-dom.js": null, "__mocks...
null
110
javascript
import * as THREE from "three"; const world = Globe() .globeImageUrl("img/world.topo.200412.3x21600x10800.png") .bumpImageUrl("img/earth-topology.png") .backgroundImageUrl("img/night-sky.png")(document.getElementById("globeViz")); // custom globe material const globeMaterial = world.globeMaterial(); new THREE.T...
take the globe countries layer from below "// this" and add it to the existing globe
/** * Test suite for Globe implementations */ const fs = require('fs'); const path = require('path'); const glob = require('glob'); // Find implementation files const findImplementations = () => { const baseDir = path.resolve(__dirname, '..'); const patterns = [ 'modified_code\\d+\\.js', 'new_code\\d+\\....
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "scripts": { "test": "jest --forceExit" }, "devDependencies": { "jest": "^29.7.0", "glob": "^10.3.10" }, "jest": { "setupFilesAfterEnv": ["...
// jest-setup.js // This file is intentionally empty as we now handle all testing in test_code.test.js
null
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": null, "__mocks__/Sprite.jsx": null, "__mocks__/GameMap.jsx": null, "__mocks__/CharacterStatUI.jsx": null, "__mocks__/CharacterData.js": null, "__mocks__/react-router-dom.js": null, "__mocks...
null
111
javascript
import React from 'react'; import styles from './CharacterStatUI.module.css'; import Sprite from '../sprite/Sprite'; import SingleCharacterStatUI from '../single-character-stat-ui/SingleCharacterStatUI'; import MockChild from '../mock-child/MockChild'; const CharacterStatUI = ({ charName, level, wpn, hp, atk, spd, def...
import React from 'react'; import styles from './CharacterStatUI.module.css'; import Sprite from '../sprite/Sprite'; import SingleCharacterStatUI from '../single-character-stat-ui/SingleCharacterStatUI'; import MockChild from '../mock-child/MockChild'; const CharacterStatUI = ({ charName, level, wpn, hp, atk, spd, def...
The following is the CSS style of the React component: ```css .characterTable { display: grid; grid-template-columns: auto 1fr 1fr; grid-template-rows: 1fr; gap: 0px; width: 100%; max-width: 800px; margin: 0 auto; isolation: isolate; } .characterCell { display: flex; flex-direc...
import React from 'react'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import fs from 'fs'; import path from 'path'; // Import the implementations directly from the setup file const { implementations, resultsManager } = require('../jest-setup'); // Testing parameters c...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "scripts": { "test": "jest --config jest.config.js" }, "devDependencies": { "jest": "^29.7.0", "glob": "^10.3.10", "@testing-library/react": "^...
// jest-setup.js - Copy this file to each implementation folder const fs = require('fs'); const path = require('path'); const glob = require('glob'); const { TextEncoder, TextDecoder } = require('util'); // Handle JSX files instead of only JS files require('@testing-library/jest-dom'); global.TextEncoder = TextEncode...
module.exports = { presets: [ [ '@babel/preset-env', { targets: { node: 'current', }, }, ], '@babel/preset-react', ], };
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": null, "__mocks__/Sprite.jsx": null, "__mocks__/GameMap.jsx": null, "__mocks__/CharacterStatUI.jsx": null, "__mocks__/CharacterData.js": null, "__mocks__/react-router-dom.js": null, "__mocks...
null
112
javascript
import React from 'react'; import { Meta, Story } from '@storybook/react'; import CharacterStatUI from './CharacterStatUI'; export default { title: 'CharacterStatUI', component: CharacterStatUI }; const Template = (args) => <CharacterStatUI {...args} />; export const Default = Template.bind({}); Default.args = {...
null
Please make this Storybook test include the parameters: name="Alfonse", level=40, "Folkvangr", wpn=50, atk=50, spd=50, def=30, res=30
// tests/test_code.test.js describe('Storybook CharacterStatUI implementation tests', () => { // Basic initialization test test('Global test variables should be defined', () => { expect(global.__TEST_UTILS__).toBeDefined(); expect(global.__RESULTS_MANAGER__).toBeDefined(); expect(global.__IMPLEMENTATION...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "type": "commonjs", "scripts": { "test": "jest" }, "dependencies": { "react": "^18.2.0", "react-dom": "^18.2.0" }, "devDependencies": { "...
// jest-setup.js const fs = require('fs'); const path = require('path'); const glob = require('glob'); const babel = require('@babel/core'); /** * Utility class to handle JavaScript implementations */ class TestUtils { /** * Find all implementation files in the current directory * @param {string} directory -...
null
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": null, "__mocks__/Sprite.jsx": null, "__mocks__/GameMap.jsx": null, "__mocks__/CharacterStatUI.jsx": null, "__mocks__/CharacterData.js": null, "__mocks__/react-router-dom.js": null, "__mocks...
null
113
javascript
import React, { useRef, useEffect, useState } from 'react' import { useGetQueryListQuery } from '../../api/query'; import { MdOutlineArrowDropDown } from 'react-icons/md'; const Query = () => { const abortController = useRef(null); const [isQueryOpen, setIsQueryOpen] = useState(false); const [selectedQuery, se...
<label className="font-thin border">Query name</label>
adjust width according to content
const fs = require('fs'); const path = require('path'); const React = require('react'); const { render, screen, fireEvent, within } = require('@testing-library/react'); const { TestUtils, resultsManager } = require('../jest-setup'); // Import the instruction to check implementations against const instruction = fs.read...
null
null
null
test
{ "name": "js-test-framework", "version": "1.0.0", "description": "JavaScript testing framework for multiple implementations", "main": "index.js", "type": "commonjs", "scripts": { "test": "jest" }, "devDependencies": { "@babel/preset-env": "^7.24.0", "@babel/preset-react": "^7.23.3", "@t...
// jest-setup.js - Setup file for Jest tests const fs = require('fs'); const path = require('path'); const glob = require('glob'); /** * Utility class to handle JavaScript implementations */ class TestUtils { /** * Find all implementation files in the current directory * @param {string} directory - Directory...
module.exports = { presets: [ ['@babel/preset-env', { targets: { node: 'current' } }], ['@babel/preset-react', { runtime: 'automatic' }] ], };
{ "hidden.js": null, "__mocks__/messages.js": null, "__mocks__/jquery.js": null, "__mocks__/MapCharacter.jsx": null, "__mocks__/Sprite.jsx": null, "__mocks__/GameMap.jsx": null, "__mocks__/CharacterStatUI.jsx": null, "__mocks__/CharacterData.js": null, "__mocks__/react-router-dom.js": null, "__mocks...
// Import jest-dom utilities require('@testing-library/jest-dom');