|
Download code/bad008.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/3c88a0fb05e4b97a2e7d2149907a657465f5d400/code/bad008.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm@3c88a0fb05e4b97a2e7d2149907a657465f5d400/code/bad008.jsonl
-
curl -L -o bad008.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/3c88a0fb05e4b97a2e7d2149907a657465f5d400/code/bad008.jsonl
2.35 kB
| {"type": "session", "harness": "deepseek-harness", "id": "bad008", "name": "Bad testing practices"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}} | |
| {"type": "message", "message": {"role": "user", "content": "What are bad testing practices?"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "**Bad Testing Habits:**\n\n1. **No Tests At All:**\n```python\n# Bad: ship and pray\ndef calculate_total(items):\n return sum(i.price for i in items) # hope it works\n\n# Good: write tests first\ndef test_calculate_total():\n items = [Item(price=10), Item(price=20)]\n assert calculate_total(items) == 30\n```\n\n2. **Testing Implementation, Not Behavior:**\n```python\n# Bad: tests internal calls\ndef test_user_creation():\n user = User(\"test\")\n assert user._generate_id() is not None # tests private method\n\n# Good: tests public behavior\ndef test_user_creation():\n user = User(\"test\")\n assert user.is_valid()\n```\n\n3. **Test Interdependence:**\n```python\n# Bad: tests depend on order\ndef test_create_user():\n global user\n user = create_user(\"test\")\n\ndef test_delete_user():\n user.delete() # fails if test_create_user not run first\n```\n\n4. **Ignoring Failures:**\n```python\n# Bad\ntry:\n assert result == expected\nexcept AssertionError:\n pass # just ignore failures\n\n# Good: fix or mark as known issue\n@pytest.mark.xfail(reason=\"Bug #123\")\ndef test_known_bug():\n assert buggy_function() == expected\n```\n\n5. **No Edge Case Testing:**\n```python\n# Bad: only happy path\ndef test_divide():\n assert divide(10, 2) == 5\n\n# Good: test edge cases\ndef test_divide():\n assert divide(10, 2) == 5\n assert divide(0, 1) == 0\n assert divide(-1, 1) == -1\n with pytest.raises(ZeroDivisionError):\n divide(10, 0)\n```\n\n6. **Tests That Take Too Long:**\n- Slow tests get skipped\n- Keep unit tests under 100ms\n- Integration tests separate from unit tests"}} | |